Site Loading

Exclusive access could not be obtained

I have come across this issue a number of times when an unknown process is using the database when I am trying to restore it.

I solved this by using the following query to find the process Id:

SELECT spid, loginame, login_time, program_name
FROM [master]..sysprocesses
WHERE DBID=DB_ID(‘DatabaseName’)

Then to kill it, you would use:

Kill id — eg kill 52

Close