How to make a Database offline or online During Maintenance

With the help of Alter database Command

We can make the database offline or online with the help of the Alter database command. The Alter Database command to make the database offline is:

    ALTER DATABASE databasename SET Offline

If we want to make the database online we can use the following Alter Database command:

  ALTER DATABASE databasename SET Online

With the help of the Db_options

We can also use the db_options command to make a database offline or online.To make a database offline we can use the following command:

sp_dboption databasename ,’offline’,true

To make the database online we can use the following command:

sp_dboption databasename ,’offline’,false

With Management Studio :

select database in object explorer -> select Tasks -> select Take Offline

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s