
Symptom
You are getting below error while trying to restore a database using SQL Server Management Studio.

Restore of database ‘SID’ failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)
Additional information:
System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.SmoExtended)
Solution
1. Login to your Microsoft SQL Server Management Studio. Right click to your database and select Properties. Next, select Options page. On your right panel, scroll down and till you see Restrict Access. Now, change the state to SINGLE_USER.

2. Now, you will see the single user symbol on the database. You may proceed to restore the database again.

3. Alternatively, you may execute below command to change to SINGLE USER mode.
USE master
Go
ALTER DATABASE DATABASE_SID SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
4. Don’t forget to set it to MULTI USER access once restoration is done.
ALTER DATABASE DATABASE_SID SET MULTI_USER WITH ROLLBACK IMMEDIATE;


