0

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:

  1. Creating a blank db and trying to overwrite it. - No difference
  2. Rebooting the SQL server - No difference
  3. Tried restoring to a different name - No difference
  4. Tried restoring to different filepaths - No difference
  5. Made sure it is not the default db - It's not
  6. Restoring in single user mode - No difference
  7. Making sure the db has no query windows - None there
  8. 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.

SysAdminUK
  • 113
  • 1
  • 2
  • 14

1 Answers1

1

There was a tick box in Take Tail-log backup before restore by default, which was causing the restore to fail. Removing the check made it work.

SysAdminUK
  • 113
  • 1
  • 2
  • 14