Microsoft SQL 2005 backup / replace script
- Angelo Schalley
- Oct, 05, 2009
- MS SQL
- No Comments
USE database;
GO
BACKUP DATABASE database
TO DISK = ‘Y:\MSSQL_copy\database.Bak’
WITH FORMAT,
MEDIANAME = ‘databasebackup’,
NAME = ‘Full Backup off database’;
GO
RESTORE FILELISTONLY
FROM DISK = ‘Y:\MSSQL_copy\database.Bak’
RESTORE DATABASE database_copy
FROM DISK = ‘Y:\MSSQL_copy\database.Bak’
WITH MOVE ‘PROD2_Data’ TO ‘Y:\MSSQL databases\database_copy.mdf’,
MOVE ‘PROD2_Log’ TO ‘X:\MSSQL Logfiles\database_copy.ldf’;
GO