You are here

SQL Server - Database Stuck In Single User Mode

If you put your database into SINGLE USER mode but someone connects before you, then they lock you out!  Not good!  How do you regain control?  You need to find the SPID of the connected user and kill the SPID (not the user).

http://serverfault.com/questions/285232/sql2005-stuck-in-single-mode-user
    
    
*/

-- Find the SPID
SELECT * FROM MASTER..SysProcesses WHERE dbid = DB_ID('DB_NAME_HERE')

-- Kill the SPID
-- KILL ENTER_THE_SPID_NUMBER
Categories: 
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer