Does compression enable checksum for the backups automatically?

I am not sure if this is a bug or an issue with BOL documentation, but BOL says here http://msdn.microsoft.com/en-us/library/ms186865.aspx: “(CHECKSUM) Specifies that the backup operation will verify each page for checksum and torn page, if enabled and available, and generate a checksum for the entire backup. This is the default behavior for a compressed backup”.

So, let’s run some tests.

 

Create three backups: backup a database without compression, then backup a database with compression and finally backup it with CHECKSUM:

BACKUP DATABASE msdb TO DISK = ‘K:\BACKUPS\msdb_compressed.bak’

WITH COMPRESSION, COPY_ONLY

BACKUP DATABASE msdb TO DISK = ‘K:\BACKUPS\msdb_NOT_compressed.bak’

WITH COPY_ONLY

BACKUP DATABASE msdb TO DISK = ‘K:\BACKUPS\msdb_CHECKSUM.bak’

WITH CHECKSUM, COPY_ONLY

Run RESTORE HEADERONLY for the backups created without CHECKSUM:

RESTORE HEADERONLY FROM DISK = ‘K:\BACKUPS\msdb_compressed.bak’

RESTORE HEADERONLY FROM DISK = ‘K:\BACKUPS\msdb_NOT_compressed.bak’

Actual results: Both results have “HasBackupChecksums” column equal to 0.

Expected Results: Expecting “HasBackupChecksums” column to have value equal to 1 for the compressed backup (based on documentation).

 

Run RESTORE HEADERONLY for the backup created with CHECKSUM:

 

RESTORE HEADERONLY FROM DISK = ‘K:\BACKUPS\msdb_CHECKSUM.bak’

“HasBackupChecksums” column is equal to 1 as expected.

It does not look that CHECKSUM enabled automatically when COMPRESSION is enabled for the backup.

 

So, the questions are:

  • Is this the documentation issue?
  • Does compression really automatically enables checksum for the backups?

I have sent these questions to Microsoft, so if you want to know the answers as well – come back later. I will publish thier response as soon as I get it.

Share

One thought on “Does compression enable checksum for the backups automatically?

  1. It took some time for other people to catch this too. Brent Ozar was blogging about this as well here http://www.brentozar.com/archive/2013/12/alwayson-availability-groups-backup-checksums-and-corruption/.

    Here is the Microsoft Connect link: https://connect.microsoft.com/SQLServer/feedback/details/770276/backup-compression-enables-checksum.
    The conclusion is – SQL Server BOL documentation is misleading, but this won’t be fixed (closed as “Won’t Fix”).

Leave a Reply