[fix] - RESTORE cannot process database
- To restore a DB via a .bak file using SSMS window as follows:
- Restore failed for Server 'database_name'. (Microsoft.SqlServer.Smo)System.Data.SqlClient.SqlError: RESTORE cannot process database 'database_name' because it is in use by this session. It is recommended that the master database be used when performing this operation. Microsoft.SqlServer.Smo)
Reason for the error :
- The DB for restore is in use by other user.
- The database may be set as default database with respect to an user login.
Fix 1 :
- Verify the activity monitor to close all open connections to the DB
- Kill all idle connections from other users.
- Note: Both the above process must be performed with critical care in the production servers.
Fix 2 :
- Change the default DB for the user from current DB to master DB.
Applies to sqlserver version :
- SQL Server 7.0 OLAP Tools
- SQL Server 2000 64-bit Edition
Related Error Tags :
- Unable to restore Database, Database is in use by session
- c# - Error :RESTORE cannot process database
- Can't restore SQL 2008 backup - error that the database is in use
- Bug: RESTORE cannot process database 'database_name'
- C# - Database Restoration Fails With An Error
- SQL: Errors related to restore database
- sql server - Error in restore database
- RESTORE cannot process database 'database_name'
- Can't restore SQL 2008 backup - error