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)