Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SQL Server: Why is it taking so long to take a database offline?

Originally posted on: http://geekswithblogs.net/AskPaula/archive/2017/08/11/sql-server-why-is-it-taking-so-long-to-take.aspx

There are probably open sessions on the database you are attempting to bring offline. SQL Server is trying to roll back any existing workloads in-flight for that database. 

Issue the sp_who2 command from a new connection (master db) and view what's active. If you see activity, let it complete--or if you don't want the sessions to complete for whatever reason, issue the kill command for the spid(s).  

In the future, use this command:

ALTER Database Yourdbname Set OFFLINE WITH ROLLBACK IMMEDIATE;

To bring the db back online:

ALTER Database yourDBName SET ONLINE



This post first appeared on , please read the originial post: here

Share the post

SQL Server: Why is it taking so long to take a database offline?

×

Subscribe to

Get updates delivered right to your inbox!

Thank you for your subscription

×