Wednesday, September 11, 2013

SQL Server: Script to get database offline and bring online


Being DBA or database professional most of us need to take databases offline and bring online for many reason. Below script will hep you to take a database offline and bring line back.

USE master
GO
-- Script to take the database offline
ALTER DATABASE [Your DBNam>] SET OFFLINE WITH
ROLLBACK IMMEDIATE
GO

-- Script to bring the database online
ALTER DATABASE [Your DBNam>] SET ONLINE
GO






Please replace  with actual database name.

No comments:

Post a Comment