Our Cookie Policy

Echofavor and carefully selected third parties use cookies on this site to improve performance, for analytics and to show you offers tailored to your interests on our site and third party sites. By continuing to use our site, you consent to our use of cookies. Privacy Policy

Life is memorable. Share your experience. Help others. Return the favor. Terms Of Use    Privacy Policy    About    FAQ    Help   Contact Us  
As an Amazon Associate and affiliate with other third parties, Echofavor earn from qualifying purchases and display advertisements.
0.0838181

Exclusive access could not be obtained because the database is in use Sql Server Restore Failed - System.Data.SqlClient.SqlError

  • mcchu28
  • 394 views

Possibly save 1 hour of your time: This happens when I try to restore a database.

exclusive access could not be obtained because the database is in use sql server restore failed

First, make sure your destination is pointing to the right database name. In my case, the destination is a new database I created. And I use the source from a backup .bak file.

Under Files menu, I forgot to check the box for Relocate all files to folder. This will restore to the right location on your machine. So enter the data file folder and log file folder. Under Restore As column, make sure it is pointing to correct mdf and log file name. Under column Restore As, you may need to change the name of the mdf and log file to the same name as the one your database use.


If the above doesn't work, try the following. Go to Options right away and check the box Close existing connections to destination database. I also choose Overwrite the existing database. I also uncheck Take tail-log backup before restore.

close existing connections to destination database.png






  

Copyright © Echofavor 2021. All Rights Reserved. Powered by Echofavor
Copyright © Echofavor 2021. All Rights Reserved.
Powered by Echofavor