SQL Kill connections on a database , sometimes is the most efficient way forward.I had to copy a whole bunch of MDF\LDF files from a server , but was experiencing some problems regarding user connections.
#####################code start############################# USE [master] GO EXEC master.dbo.sp_detach_db @dbname = N'MY_DB', @keepfulltextindexfile=N'true' GO #####################code end#############################
which was not allowing me to detach . The following code allowed me to clear the connnections and
do the detaching
#####################code start############################# alter database MY_DB set single_user with rollback immediate alter database MY_DB set multi_user with rollback immediate #####################code end#############################Author: Jack Vamvas (http://www.sqlserver-dba.com)
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |