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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
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.
Jason-Author Commented:
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.
Scott PletcherSenior DBACommented:
Do you need to just restore a single backup, or do you need to apply a differential/logs?

For just a restore, don't use the GUI for that, use a RESTORE command.  It's much better control, and easier to repeat later.  You will need the logical file names, which you can get from this command:

FROM DISK = '<backup_file_path_and_name>'

If you need to apply logs, you'd have to generate the restore command, you wouldn't want to write that by hand.

Then you're ready for this command:


FROM DISK = '<backup_file_path_and_name>'
    MOVE 'FOXVISUAL_LOG' TO '<path_to_file>\TESTVISUAL_1.LDF',

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott PletcherSenior DBACommented:
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!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.