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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 copy database

Author  Topic 

slimjen
Yak Posting Veteran

61 Posts

Posted - 2006-10-12 : 15:02:58
How do I copy a database from one server to another? Do I have to take the database offline to perform this task?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-12 : 15:09:31
Just perform BACKUP DATABASE on the source server, copy the file to the destination server, then perform RESTORE DATABASE on the destination server. This method does not require the database to go offline during it.

I do not recommend the DTS copy database option as it isn't an exact copy like BACKUP/RESTORE. The only other good option is sp_detach_db/sp_attach_db, but that requires the source to be taken offline until you are done copying the MDF and LDF.

Tara Kizer
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-10-13 : 01:19:32
I think first one is the easy one

Vinod
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-13 : 01:50:19
quote:
Originally posted by sunsanvin

I think first one is the easy one

Vinod



Yes, but second one is much faster!

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-10-13 : 04:33:23
faster? how?

+1 for backup and restore (remember to script out the logins and apply them on the restored database to avoid orphaned users)

--------------------
keeping it simple...
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2006-10-13 : 05:22:31
Backup/restore is probably best. If you copy the logins across with identical SIDs beforehand then you won't even have to re-link the users.

-------
Moo. :)
Go to Top of Page

sponguru_dba
Yak Posting Veteran

93 Posts

Posted - 2006-10-13 : 05:31:56
Hi


Moving DB only not enough,you have move user also plan for all and move the Database


SreenivasaRao
Bangalore,INDIA
09342196319
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-13 : 12:51:17
Here's how to copy the logins as well:
http://www.sqlmag.com/articles/index.cfm?articleid=16090&

Tara Kizer
Go to Top of Page
   

- Advertisement -