all groups > sql server dts > august 2006 >
You're in the

sql server dts

group:

Backup 1 DB, Restore to a different DB



Backup 1 DB, Restore to a different DB AJ
8/21/2006 1:36:02 PM
sql server dts: Hello,

Every night, I would like a job to backup our production database and
restore it to another database. The second database is to be used for
testing, but we want to keep the data the most current. Does anyone know if
this is possible to do? We tried doing an export, but it takes way too long.

Any suggestion is very appreciated.

RE: Backup 1 DB, Restore to a different DB AJ
8/21/2006 2:18:01 PM
Now I have something, but I get an error that I need to use WITH REPLACE, but
I can't find the syntax for WITH REPLACE.

Here is what I am doing:


BACKUP DATABASE Northwind
TO DISK = '\\jd\d$\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Northwind.bak'
RESTORE FILELISTONLY
FROM DISK = '\\jd\d$\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Northwind.bak'
RESTORE DATABASE TestDB
FROM DISK = '\\jd\d$\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Northwind.bak'
WITH MOVE 'Northwind' TO '\\jd\d$\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\test\testdb.mdf',
MOVE 'Northwind_log' TO '\\jd\d$\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\test\testdb.ldf'
GO

Here is the error:


Server: Msg 3141, Level 16, State 1, Line 5
The database to be restored was named 'Northwind'. Reissue the statement
using the WITH REPLACE option to overwrite the 'TestDB' database.
Server: Msg 3013, Level 16, State 1, Line 5
RESTORE DATABASE is terminating abnormally.






[quoted text, click to view]
AddThis Social Bookmark Button