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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 how to copy database

Author  Topic 

AlanS
Starting Member

28 Posts

Posted - 2004-03-23 : 17:40:33
I need a way to quickly make a copy of a database and all of the objects in it. What's needed is a development database, that programmers can use to test their bug fixes and enhancement, and that includes all the ojbects (tables, stored procedures, users, etc.) that the production database has. Since there are daily changes in tables, stored procedures, etc., I'll need to be able to run this procedure frequently, usually while users are in the production database. Everything I've tried (import/export wizard, copy database wizard, etc.) has errored out without giving me a complete copy.

How can I do this? Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-23 : 18:11:25
Use BACKUP/RESTORE to copy a database. Don't use the copy database wizard. If you are able to bring production down for a couple of minutes, then you can use DETACH/ATTACH method. If not, use BACKUP/RESTORE.

After the database has been restored, make sure to unorphan the accounts with sp_change_users_login (there is a script in the script library that can do it for all users).

Tara
Go to Top of Page
   

- Advertisement -