If you receive an error that the database is in use, try to set the user to single user mode: USE master; GO ALTER DATABASE Database_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE; Then try the restore with recovery command again. Also, make sure you are on the latest service pack or cumulative update.
Use this code to destory all existing connections before restore:
USE master;
GO
ALTER DATABASE YourDB
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE YourDB
SET MULTI_USER;
GO
Select the backup file to restore and go to options to select "Close existing connections to destination database" and click ok
Restarting the SQL Service solves my problems.
The problem is that your database is currently being used by others and probably has open connections. What you would need to do is close all the existing connections to it, and then restore your backup.
Here is a link showing how to kill active connections: http://wiki.lessthandot.com/index.php/Kill_All_Active_Connections_To_A_Database
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With