Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hey all,

I have teaching myself SQL by playing around in the AdventureWorks database in SQLServer 2005. But now I want to start working with real data. I do not want to work with the actual live production DB in case I mess things up, but I do need all the data, tables, stored procs, permissions, etc. How can I copy the live DB to another DB (say myDB to Copy_of_MyDB)?
Posted

Use backup restore method explained here[^]
 
Share this answer
 
If you can stop your SQL server at your production DB for a few min then you may try the following

1. Go to SQL Server management studio.
2. run select filename from sysfiles
3. Note down the filenames shown
4. Stop SQL Server service.
5. Copy those files you have noted and paste the same in your any folder of your development server.
6. Restart the SQL server service of your Production DB
7. Use sp_attach_db to and attach those files into a new DB with the name of your chioce.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900