-- Backup database 'dbA'
BACKUP DATABASE [dbA]
TO DISK = N'C:\MSSQL\Backup\dbB.Comp090525220021.BAK'
WITH NOFORMAT, NOINIT,
NAME = N'dbA-Full Database Backup'
, SKIP, NOREWIND, NOUNLOAD, STATS = 10
, COPY_ONLY -- don't interfere with backup-schema
GO
-- Restore database 'DbA' from previously taken backup
-- command invalidated to prevent accidents
--RESTORE DATABASE [dbA]
RE STORE DATABASE [dbA]
FROM DISK = N'C:\MSSQL\Backup\dbB.Comp090525220021.BAK'
WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
GO
-- Restore database 'dbB' from previously taken backup of database 'dbA'
-- command invalidated to prevent accidents
--RESTORE DATABASE [dbB]
RE STORE DATABASE [dbB]
FROM DISK = N'C:\MSSQL\Backup\dbB.Comp090525220021.BAK'
WITH FILE = 1,
MOVE N'db_Data' TO N'C:\mssql\DATA\dbB.mdf',
MOVE N'db_Log' TO N'C:\mssql\DATA\dbB_1.ldf', NOUNLOAD, REPLACE, STATS = 10
GO
|