Saturday, December 25, 2010

Take a SQL Server Database Offline

Take a SQL Server Database Offline


Take a Database Offline using T-SQL and wait for existing connections to close

ALTER DATABASE AdventureWorks SET OFFLINE


The command waits for existing connections to close and also does not accept any new connections. Use at discretion!



Take a Database Offline Immediately using T-SQL



ALTER DATABASE AdventureWorks
SET OFFLINE WITH ROLLBACK IMMEDIATE




Bring back the Database Online

ALTER DATABASE AdventureWorks

No comments:

Post a Comment