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:
- SQL SERVER – Take Off Line or Detach Database
- T-SQL Script to Take Database Offline – Take Database Online
Reference:Â Pinal Dave (https://blog.sqlauthority.com)
2 Comments. Leave new
Thanks Pinal! Is there a DDL trigger we can use to prevent this from being run inadvertantly?
I think that should be possible. Have you tried?