Search

Wednesday, July 27, 2011

Ad-hoc Backups with SQL Server 2005/2008 COPY_ONLY option

There are few Scenarios where we need the ad-hoc backups of the database like periodic refreshes of test/qa databases, which often requires the prod db to be restored on test/qa databases. In these kind of scenarios we can use copy_only option. The benefit of using the COPY_ONLY option is that it doesn't break the regular backup chain - so it won't disrupt the restore routine required for regular log, or differential backups.

BACKUP DATABASE MyDB TO DISK='C:\MyDB_backup.bak’ WITH COPY_ONLY

Using this option to take ad-hoc backup would not affect the database recoverability and the ad-hoc .BAK file may also be deleted (if required).

No comments:

Post a Comment