Situation - We have a Live_db database, and a Test_db database. I'm trying to Take a copy of Live to use as Test.
A Backup of Live was taken. The existing Test database was deleted (closing existing connections) as we needed no data from it. I am trying to restore the Live_db with the name Test_db and choosing the changing the filepath so it points to test_db_data.MDF and test_db_log.LDF but the restore keeps failing.
TITLE: Microsoft SQL Server Management Studio ------------------------------ Restore of database 'TEST_DB' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks) ------------------------------ ADDITIONAL INFORMATION: System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.SmoExtended)
How can the database be in use when it doesn't even exist? There is a lot of information about this error, but none of it is helping.
Things I've tried to fix it based on advise from other threads on the web:
- Creating a blank db and trying to overwrite it. - No difference
- Rebooting the SQL server - No difference
- Tried restoring to a different name - No difference
- Tried restoring to different filepaths - No difference
- Made sure it is not the default db - It's not
- Restoring in single user mode - No difference
- Making sure the db has no query windows - None there
- Make sure none of the tables are being browsed to - DB deleted, no tables
I'm completely at a loss. All I want to do is take a copy of LIVE_DB and create it as TEST_DB. Can someone help? I'm using the GUI if that makes a difference.