A copy-only backup is a SQL Server backup that is independent of the sequence of conventional SQL Server backups. Usually, taking a backup changes the database and affects how later backups are restored. However, occasionally, it is useful to take a backup for a special purpose without affecting the overall backup and restore procedures for the database. For this purpose, SQL Server 2005 introduces the following types of copy-only backups:
- Copy-only full backups (all recovery models)
A copy-only full backup cannot serve as a differential base or differential backup and does not affect differential backups.
- Copy-only log backups (full recovery model and bulk-logged recovery model only)
A copy-only log backup preserves the existing log archive point and, therefore, does not affect the sequencing of regular log backups. Copy-only log backups are typically unnecessary. Instead, you can create another routine, current log backup (using WITH NORECOVERY), and then use that backup together with all other previous log backups that are required for the restore sequence. However, a copy-only log backup can be created for performing an online restore. For an example of this, see Example: Online Restore of a Read/Write File (Full Recovery Model).
The transaction log is never truncated after a copy-only backup. Copy-only backups are recorded in the is_copy_only column of thebackupset table.
To create a copy-only backup (Transact-SQL)
SQL Server Management Studio does not support copy-only backups.
For a copy-only full backup, the required BACKUP syntax is:
BACKUP DATABASE database_name TO <backup_device*>* … WITH COPY_ONLY …
COPY_ONLY has no effect when it is specified with the DIFFERENTIAL option.
For a copy-only log backup, the required BACKUP syntax is:
BACKUP LOG database_name TO <backup_device> … WITH COPY_ONLY …