Pages

Search This Blog

Monday, November 1, 2010

[T-SQL] Taking backup at two places same time

If you want to take backup of any DB at two places same time then following tsql need to be executed.

BACKUP DATABASE [AdventureWorks] TO
DISK = N'D:\AdventureWorks.bak'
MIRROR TO DISK = N'E:\AdventureWorks.bak'
WITH FORMAT, INIT,
NAME = N'AdventureWorks-Full Database Backup'
GO

Dont use the below tsql as it would break your db backup into two file and it would not serve the purpose. I mean you would be needing both of these files when you are restoring the database.

BACKUP DATABASE [AdventureWorks] TO
DISK = N'D:\AdventureWorks.bak'
, DISK = N'E:\AdventureWorks.bak'
WITH FORMAT, INIT,
NAME = N'AdventureWorks-Full Database Backup'
GO

No comments: