fbpx
6

Exclusive Access Could Not Be Obtained Error During SQL Restore

Ever try to restore a .bak file to Microsoft SQL Server and get the following error? “Exclusive access could not be obtained because the database is in use”

One way get the restore working again is to use this script;

alter database db_name
set offline with rollback immediate
alter database db_name
set online

This clears the connections and then you can try your restore.

But sometimes that does not even work.

Another solutions is to Right Click on Properties -> Options menu. At the bottom, Restrict Access option is set to MULTI_USER. Change it to SINGLE_USER. Then restore the database. After the restore, the Restrict Access will be changed back to MULTI_USER. Double check to be sure.

 

Click Here to Leave a Comment Below 6 comments