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
 MSDE (2000)
 Rename copy of production db to a test db?

Author  Topic 

sbt1
Yak Posting Veteran

89 Posts

Posted - 2003-12-02 : 09:14:34
I need to make a copy of my production database and save it as a test database.

Do I just detach, rename the .MDF and .LDF to the new (Test) name, and restart SQL Server?

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-12-02 : 21:19:05
You are best of backing up your database, then restoring it as the new (test) name.

You will need to change the file names created so they don't clash with the existing files.

Something like :

RESTORE DATABASE Test
FROM DISK = 'C:\backups\live.bak'
WITH
MOVE 'Live_Data' TO 'C:\MSSQL\data\Test_Data.MDF',
MOVE 'Live_Log' TO 'C:\MSSQL\data\Test_STAGE_Log.LDF'


Obviously you will need to change the paths, use Exec sp_help_db LiveDatabase to find out what your files are called.



Damian
Go to Top of Page
   

- Advertisement -