Interview Question of the Week #049 – Taking Database Offline

Here is the conversation which I observed the other day.

Question: How do we take database off-line?

Answer: Well, we can run following script to take the database offline.

ALTER DATABASE [mydb] SET OFFLINE WITH
ROLLBACK IMMEDIATE

Question: Let us assume that your boss suggest that you should wait 30 seconds before taking the database offline, but no new processes should start during this 30 seconds what will be the command for the same?

Answer: We can easily change the time interval to take the database offline. Here is the script for the same.

ALTER DATABASE [mydb] SET OFFLINE WITH
ROLLBACK AFTER 30 SECONDS


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

Previous Post
SQL SERVER – Discussion on understanding NUMA
Next Post
SQL SERVER – Fix SQL Server Index Fragmentation with dbForge Index Manager

Related Posts

Leave a Reply

Menu