Single user mode issue

Sometimes ,mostly because you did something , your DB is stuck in a single user mode and you cannot connect to it anymore.

Below steps can help if you don’t know which user is connected to the DB.

SELECT request_session_id FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID(‘YourDatabase’)

It will return the process connected to the DB with PID
Then kill all process that use your database with following query:

KILL spid

Then run following query to change to multi user mode.

USE Master


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s