Search

Thursday, August 4, 2011

T-SQL Script to Take Database Offline/Online

-- Create Test DB

CREATE DATABASE [TestDB]
GO
-- Take the Database Offline
ALTER DATABASE [TestDB] SET OFFLINE WITH
ROLLBACK IMMEDIATE
GO
-- Take the Database Online
ALTER DATABASE [TestDB] SET ONLINE
GO
-- Clean up
DROP DATABASE [TestDB]
GO



No comments:

Post a Comment