No, log shipping or point-in-time recovery will not work correctly if you use only one set of backups (e.g., apply only SQL Agent full backup and log backups) while another set of backups (e.g., from a third-party tool) is being taken without the COPY_ONLY option. This is because each backup method without COPY_ONLY affects the Log Sequence Numbers (LSNs), disrupting the backup chain required for both log shipping and point-in-time recovery. For a reliable backup strategy, use a single backup solution consistently or ensure the secondary backups use the COPY_ONLY option to avoid interfering with the LSN sequence.
Using two different backup methods (SQL Agent and a third-party backup tool) without the COPY_ONLY option can lead to complications with log shipping and point-in-time recovery. Here’s why:
Backup Chain
When you take a backup using a method without the COPY_ONLY option, it becomes part of the database's backup chain. SQL Server maintains a sequence of log backups that are essential for point-in-time recovery. Introducing a second backup method that is not synchronized with the first can break this sequence.
Log Sequence Numbers (LSNs)
Each log backup has a unique Log Sequence Number (LSN). The SQL Server uses these LSNs to keep track of the backup chain. When you take a log backup using one tool, it changes the LSN sequence, which the other tool does not account for. This results in each tool's log backups not being able to follow the LSN sequence correctly, causing issues with restoring the database to a point in time.
Implications for Log Shipping and Point-in-Time Recovery
Log Shipping
Log shipping relies on a consistent chain of log backups. If you use only the SQL Agent backups for log shipping:
- Full Backup: You will need to restore the full backup taken at 12:00 AM.
- Log Backups: You can restore the log backups taken every hour starting from 12:00 AM by the SQL Agent.
However, if the third-party tool takes a log backup at 12:30 AM, it will alter the LSN sequence, breaking the chain. This would mean any log backup taken by the SQL Agent after 12:30 AM would be invalid for log shipping.
Point-in-Time Recovery
Point-in-time recovery also relies on a consistent chain of log backups. If you attempt to use only the SQL Agent backups:
- Full Backup: Restore the full backup taken at 12:00 AM.
- Log Backups: Apply the log backups taken every hour starting from 12:00 AM by the SQL Agent.
As with log shipping, if the third-party tool takes log backups, they will alter the LSN sequence, making it impossible to apply subsequent SQL Agent log backups for point-in-time recovery.
Recommendations
To ensure log shipping and point-in-time recovery work correctly, you should:
- Use a Single Backup Solution: Choose either the SQL Agent or the third-party backup tool for all your backups. This ensures that the LSN sequence remains consistent.
- Use COPY_ONLY for the Second Backup: If you must use both methods for redundancy, configure the second backup to use the COPY_ONLY option. This will prevent it from altering the LSN sequence, but note that these backups won't be part of the regular backup chain and can’t be used for log shipping or point-in-time recovery.
Log shipping and point-in-time recovery will only work correctly if you use a consistent set of backups from one method. Mixing backups from different methods without using COPY_ONLY will break the LSN sequence, making it impossible to achieve reliable log shipping or point-in-time recovery.