SQL Server - Restore cannot process database because it is in use by this session
A number of ScriptLogic applications, such as Active Administrator, Enterprise Security Report, and File System Auditor, utilize a backend SQL database, and may encounter the error below.
When the user attempts to restore a database and receives the message “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.”
This error occurs if the logged on user account’s default database is set to the “Application” database.
Connect to the database instance via SQL Management Studio; expand Security, Logins, Right click on the login name, select Properties, and change the Default database to “master”. The restore operation will run successfully after this procedure.