ERROR: System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.SmoExtended)

SQL SERVER 2012 DATABASE RESTORE

Solution:

Either you can solve this issue by running a query or via DB UI

 

  • Right click on your database that  you want to restore> properties > options > State > Restrict Access > select Single user (single user to cut off all the connections to the db that you are restoring)
  • Restore your database
  • Change the State back to Multi-User

 

Leave a Reply

Your email address will not be published. Required fields are marked *