I wanted to drop  a DB inorder to restore a recent copy on our test bed. However for some reason it didnt work for the DB was caught up in  a deadlock and my drop transaction was selected as the roll back candidate. I have to use a combination of scripts to get going as the DB in that case had reverted into  a single user mode.

1. Get the connections to the DB

select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid  where d.name = 'database'

2. Kill the processes

kill $spid

Reference:

http://www.webhostrepo.com/blog/how-to-remove-sql-server-database-from-single-user-mode/

Leave a Reply

Your email address will not be published. Required fields are marked *