
Change the default database back to master When you disconnect the instance and connect it again, you will find the “Restoring” mark behind the database has been removed. RESTORE DATABASE databasename WITH RECOVERYĮxecute the command. restore the problematic database WITH RECOVERY.Ĭlick New Query and enter this command in the window: There’s another simple tip to fix SQL database restore failed database in use, i.e. Restore SQL Server database with recovery Launch SSMS and connect to the instance, then you can create a New Query with following commands:Įxecute it to destroy all existing connections before restore. This will close all the active connections as well. Since the SQL Server restore may fail because the database is used by other users, you can switch SQL Server to single user mode, and then set it to multi user mode again. The database in use error shall not pop up again. Switch to Options tab, and tick the Close existing connections to destination database option. In the popping-out window, choose Device and specify the bak file you want to restore from.ģ. Similar with normal operation, launch SSMS and connect to your instance, then right-click the database you want to restore and choose Tasks > Restore > Database.Ģ. If you prefer to use SSMS GUI, try ticking one more option in Restore Database window to close all the existing connections to the target database.ġ.

Close existing connections to destination database

If so, close it and the sql server database restoring issue may be solved directly. 🔹Note: Before trying these methods, please first check if there's any SQLQuery window you forget to close after finishing a query task.

Use secure alternative to restore SQL database Restart the SQL Server service thoroughly Anyway, i've listed several proven ways here, you can try them one by one to fix the SQL database restore failed database in use error: What causes SQL database stuck in restoring issue? It could be that another user is using the database, or the database file is synchronized during the re-establishing process.

When you use T-SQL or SSMS to restore SQL databases, sometimes an error may occur saying “ Exclusive access could not be obtained because the database is in use” and the problematic database will be followed by a " restoring." mark, which blocks you from any normal operation on it. Error: SQL database restore failed because the database is in use
