Interview Question of the Week #016 – How to Take Database Offline

Here is the question, I received in the recent conference where I was presenting on Database Technology.

Question: What does it mean by Taking Database Offline and How to do it?

Answer: Taking database offline means, it will be no more available for database operations. Here are is how you can take your database offline.

-- Take the Database Offline
ALTER DATABASE [myDB] SET OFFLINE WITH
ROLLBACK IMMEDIATE
GO


If you have previously taken database offline, you can once again take it online by running the following command:

-- Take the Database Online
ALTER DATABASE [myDB] SET ONLINE
GO

You can read more about it in following blogs:

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Scripts
Previous Post
SQL SERVER – Create Login with SID – Way to Synchronize Logins on Secondary Server
Next Post
SQL SERVER – How to View the Dirty Pages In Memory of a Database?

Related Posts

2 Comments. Leave new

Leave a Reply