Thursday, January 17, 2013

Taking Database Offline Hangs - SQL 2008, 2008

I've experienced this multiple times with both SQL 2005 and SQL 2008 database servers when using the SQL Management Studio GUI.  The best way to take a database offline is via TSQL, not the GUI.

Use this:


Go offline
USE master
GO
ALTER DATABASE YourDatabaseName
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
Go online
USE master
GO
ALTER DATABASE YourDatabaseName
SET ONLINE
GO

No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips