Tuesday, February 21, 2006

SQL 2005 COPY_ONLY Backup

In SQL Server 2000 or it's earlier versions, if you perform a backup of a database out of sequence/chain (Full & Diffrential or Full & Log, etc) it used to break the sequence of the backups. Meaning you had to reset the backup sequence everytime you had to take a seperate out of sequence backups of the database. Taking a backup normally changes the database, in turn affecting other backups and how they are restored. Sometimes, however, a backup must be taken for a special purpose that should not affect the overall backup and restore sequence or procedures for the database.

With SQL Server 2005, you can now perform an out of sequence backups using "COPY_ONLY" option with the backup statement and this option is available for all types of backups.

Note:
A Full backup taken with the COPY_ONLY option cannot be used as a base backup and does not affect any existing differential backups.
A Diffrential backup taken with the COPY_ONLY option is identical to a regular diffrential backup.
A Log backup taken with COPY_ONLY option causes the backup to retain the current log archive point and also the Transaction log is not truncated by a log backup.
Important: SQL Server Management Studio does not support COPY_ONLY backup/restore functionality, but you can use BACKUP & RESTORE commands using T-SQL for COPY_ONLY backup of a database.
Example:
Backup database AdventureWorks to Disk='D:\AdventureWorks.bak' with COPY_ONLY

No comments: