Tuesday, August 02, 2005

 

Copying Database from Server to Server

Description:

I have two SQL servers. A production (sql-prod1) and a staging server (sql-stage1). The staging servers job is to be a mirror image of the production server so that when I push my latest bug fixes, I can make sure that any problems are resolved in staging, before pushing to production.

As often occurs, the staging server was getting more and more cluttered with test data, and was looking less and less like the production server. I requested that the DBA replace all of the databases in staging with their corresponding databases in production. Unfortunately for me, the DBA has his own problems.

So, I found a fellow programmer who could give a DBA a run for his money and asked him to walk me through the process and he was patient enough to allow me to jot the steps down so I would not forget them in the future. For your benefit as well as my own, I have pasted these steps below. Enjoy.

How-To: Backup Database
1. Right click database, choose "All Tasks" -> "Backup Database"
2. Make sure "Database - Complete" is selected (should be the default)
3. Verify that the "Destination" area includes the file path where you wish to store the backup.
5. Choose "Overwrite Existing Media" if the above filename already exists.
6. Leave everything else default.

How-To: Restore Database
1. Select Database, choose "AllTasks" -> "Restore Database"
2. Choose "From Device"
3. Click "Select Devices"
4. Click "Add"
5. Choose File from backup processe above, click "OK". Click" OK" again to go back to main Restore Database form.
6. Click "Options" tab.
7. Check "Force restore over existing"
8. Verify that "Move to physical file name" are pointed to the correct paths (normally the default is correct)
9. Click "OK".

Comments:
There is an even easier way to copy a database when using Enterprise Manager. Go under the Tools menu, choose Wizards... Under the "Management" section is Copy Database Wizard. Just follow the steps to the Wizard!
 
Post a Comment

Links to this post:

Create a Link



<< Home
Content copyright ©2003-2006 Tod Birdsall