3

I'm trying to create a database, NewClientDB, by restoring another database's, OldClientDB, backup, d:...oldclientdb.bak. I've always done this via SQL 2000 Enterprise Manager, but the GUI keeps hanging. I've already created the empty NewClientDB.

Anyone know how to restore the OldClientDB's backup to NewClientDB via script without affecting OldClientDB?

1 Answer 1

1
RESTORE DATABASE [NewClientDB] 
FROM  DISK = N'D:\OldClientDB.bak' 
WITH  FILE = 1,  
MOVE N'OldClientDB_Data' TO N'C:\Data\MSSQL.1\MSSQL\Data\AdventureWorksNew_Data.mdf',  
MOVE N'OldClientDB_Log' TO N'C:\Data\MSSQL.1\MSSQL\Data\AdventureWorksNew_Log.ldf',  
NOUNLOAD,  STATS = 10

Source: BACKUP and RESTORE in SQL Server

2
  • I'm being pedantic, but I think the NewClientDB_Data etc need to be OldClientDB_Data as those will be the names of the files used from the original db. Jun 18, 2012 at 21:18
  • @JonEgerton Not pedantic, Correct! Ill update my answer. Jun 18, 2012 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.