Not able to restore database in SQL Server.

Error:
System.Data.SqlClient.SqlError: RESTORE cannot process database ‘MyDatabase’ because it is in use by this session. It is recommended that the master database be used when performing this operation. (Microsoft.SqlServer.Smo)

or

Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database ‘MyDatabase’ because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Not able to restore database in SQL Server.
Root Cause:
Your login to the server cannot have the database as its default.

Resolution:
Go to Security > Logins > your login user. Right click to get properties and where it says Default, put the database back to “Master.” It doesn’t take you out of the other db, just takes it out of that connection for the restore.


<<Click here to see all posts>>

If you found any of the information on this page helpful in anyway then please consider sharing this content with your favorite social network or by leaving your thoughts in the comment section. Thanks!

Leave a Reply

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

Prove You Are Human Time limit is exhausted. Please reload CAPTCHA.