-->
Have you ever encountered such an error while doing a routine database backup;

RESTORE failed for Server
Restore failed for Server 'SERVERNAME'.  (Microsoft.SqlServer.SmoExtended) ADDITIONAL INFORMATION: System.Data.SqlClient.SqlError: RESTORE cannot process database 'YourDataBaseName' because it is in use by this session. It is recommended that the master database be used when performing this operation. (Microsoft.SqlServer.Smo)
The first thing to come in mind perhaps would be to ... end all active connections to the database. Some of us would straight go to the detach database option to see the active connections. What ? 'Ctrl + Alt + A' you said for activity monitor to end the processes? Yes of course but the above error won't go even if you restart the whole SQL Server service. Why ? What could be wrong ?

The mystery in our case was the fact that for some reasons unknown, the default database was changed from master to the Dynamics AX transaction database. Now when ever you try to restore on a database that is the default database of the active user, this message would appear.

Conclusion


Make sure the database you are restoring is not your user's default database :)

0 comments:

Post a Comment

top