Error:
Restore failed for Server 'Server_Name'. (Microsoft.SqlServer.Smo)
System.Data.SqlClient.SqlError: RESTORE cannot process database 'DbName' because it is in use by this session. It is recommended that the master database be used when performing this operation.
No connection to the server in SSMS or in Activity Monitor, and the database in question is one of the user db's on the server. Clicking on one of the other db's on the server and trying the restore produces the same error. There are no query windows open. The option to Overwrite the existing database, and the Restore As paths are correct.
"SP_Who" and "SP_Who2" return no connections to the restore DB. Setting the database to single user mode by using options in database properties, or alter database your databasename set single_user with ROLLBACK IMMEDIATE command produces the error when restoring.
User also attempted closing all query windows in SSMS (or Enterprise Manager) until the only window left open is [Object Explorer Details]. In the [Object Explorer] pane, click on any database OTHER than the one you want to RESTORE. If there are no others listed, click on [System Databases], then click on the Master database.
SQL Server service could be stopped, then SQL started from the command-line with sqlservr -m (also -s server$instancename if not a default instance) and retry the restore. sqlservr.exe is usually in Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBinn However, this also fails on restore with the same error message.
You need to be signed in and under a current maintenance contract to view premium knowledge articles.
© ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center