We help IT Professionals succeed at work.

SQL Server 2012 Database Restore

Jason- asked
Last Modified: 2017-03-07
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.
Watch Question

Nakul VachhrajaniSenior Manager

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.


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.
Senior DBA
Most Valuable Expert 2018
Distinguished Expert 2019
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
Scott PletcherSenior DBA
Most Valuable Expert 2018
Distinguished Expert 2019

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!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions