Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
MVB77
Starting Member
5 Posts |
Posted - 2010-01-22 : 10:11:07
|
| I am a newbie to SQL Server 2005. How do I copy (overwrite) one database to another (same server, same instance)? Some time ago the databases were identical (created using the same .bak file). One database is for testing (DB2) the other is "live"(DB1). I'm done testing, but now I just want to essentially update the DB1 database with DB2's files/information.Someone gave me this but it's not working. Assuming the instance is named "Test":copy Test;DatabaseName=DB2 to Test;DatabaseName=DB1Thanks for your help. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-22 : 10:22:07
|
just restore a backup from the source database and give it the wanted database name.btw. I would never have a testing and a live database on the same instance - that's too dangerous... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
MVB77
Starting Member
5 Posts |
Posted - 2010-01-22 : 10:26:11
|
| Ok, thanks for the information. So I can just create an on-demand full backup from the source and restore to the existing other database? |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-22 : 10:30:38
|
Yes, but you should read about copy_only backup:http://msdn.microsoft.com/en-us/library/ms191495(SQL.90).aspx No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
MVB77
Starting Member
5 Posts |
Posted - 2010-01-22 : 11:09:58
|
| Thanks alot. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-01-22 : 11:59:04
|
Just to check:You want to copy TEST DB to LIVE DB ?That reads to me like you want to update the Live DB with the new-stuff from the Test DB, but keep the Data etc. in the Live DB; but you also said that you wanted to overwrite the destination DB ....... so, to confirm , the operations described above will overwrite you LIVE database with a copy of the TEST database, all data in LIVE will be lost, OK? |
 |
|
|
MVB77
Starting Member
5 Posts |
Posted - 2010-01-22 : 14:06:14
|
| yes, thanks for checking. i wasn't clear, sorry. the two databases were identical. data was loaded into the test database and validated and now needs to be moved to the other database which will now be the "live" production database. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-01-22 : 14:08:56
|
Sounds like you are good-to-go then |
 |
|
|
|
|
|
|
|