Solved

Restoring a database backup into another database

Posted on 2014-10-08
5
141 Views
Last Modified: 2014-10-14
Hello All,

I have an application pointing into 2 MS SQL 2005 databases, one called PRODUCTION and the other called TEST. I am attempting to replicate all information from the production database to the test database so they both have the exact same data in them.
To accomplish this, I have created a backup of the PRODUCTION database and I am now attempting to restore this backup into the TEST database using the restore utility in Management Studio. After selecting the TEST database --> right click --> Tasks --> Restore and choosing the backup that I made of my production database, in the "Restore the database as" section of the Options screen,  it appears that the restore will rename the TEST database to the name of my production database (mdf and ldf files) and I dont want this to happen, I want to maintain the original name of the database since I am sure what could happen with my application if the TEST database is renamed.

What should I do next?
0
Comment
Question by:LuiLui77
5 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 250 total points
ID: 40369889
You should be able to update the file paths on the options screen to reflect the name of your test database and then check the checkbox to overwrite the database namely your test database.
0
 
LVL 25

Expert Comment

by:Mohammed Khawaja
ID: 40369910
When you are choosing restore, have you click on the option to overwrite.  Also note that when you click on advanced, you have the option to rename the files.  When you select overwrite, it will overwrite the existing MDF and LDF with the data from the restored database.
0
 
LVL 10

Expert Comment

by:HuaMinChen
ID: 40369947
Hi,
You can also copy the relevant .mdf and .ldf files to the folder like

C:\Program Files\Microsoft SQL Server\MSSQL11.SS2002\MSSQL\DATA

within the server and further attach the DB to the new server.
0
 
LVL 47

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 250 total points
ID: 40370113
Since it's a production database I won't recommend to copy the .mdf and .ldf files because that means you'll need to stop the database during the operation.
As was said in the two first comments you can check the "overwrite the existing database" and then change the filenames and/or they location.
Here is a step-by-step on how to do it.
0
 

Author Closing Comment

by:LuiLui77
ID: 40379865
Thank you Paul, it did work by overwriting and changing the paths to reflect the test Databases.

Thanks Vitor for the clarification.

Thank you all fr you input!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
How to update Firmware and Bios in Dell Equalogic PS6000 Arrays and Hard Disks firmware update.
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question