Link to home
Start Free TrialLog in
Avatar of Jason-

asked on

SQL Server 2012 Database Restore

I have a backup of a database called FOXVISUAL from a certain point in time. I want to restore this database on the server but I am changing the name of it to TESTVISUAL. I just want to look into this database and see some particular records and how they were at this point in time. I was always able to do this in SQL Server 2005 by doing a database restore pointing to the .bak file and changing the name of the destination to the new name and renaming the MDF and LDF. This way I would have my test database and my production database running on the same SQL Server. When I do this in 2012, I get a "Exclusive access could not be obtained because the target database is in use." To which the target database is called TESTVISUAL and does not exist. I am not sure how to acheive this.
Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

After changing the destination  database name, can you check if the restore wizard is trying to restore the DB over the same files as used by the primary database? If yes, you should change the target folder and file names that need to be used by your required destination  TESTVISUAL database.
Avatar of Jason-


I have the file names set to TESTVISUAL.MDF and TESTVISUAL_1.LDF in the Files section under the restore as field. It should not be trying to write over top the primary database.
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Once that runs, apply differential, if needed, and log backup(s) if needed, then do a final recovery on the db:


And your db should be good to go!