Creating and Verifying File System Checksums
Creating or verifying a full checksum of file system structures is a very CPU‑intensive operation. To reduce CPU cycles, you can specify a sampled statistical checksum for a base table, where only a portion of the data is XORed. The sampling algorithm that generates the checksum from the block optimizes the detection of as many data corruption cases as possible using as few CPU cycles as possible. Even when sampling only one 64-bit word per disk block to generate a checksum, roughly 99.9% of disk block‑level corruption can be detected as well as some bit, byte, or byte string corruption.
The system varies the location of the words to be checked in each disk sector of a file system block to avoid favoring certain portions of a disk sector over others. The system samples 64-bit words from each disk sector when it generates the checksum.
The following drawing abstracts the process of computing a checksum by sampling a single word per disk block and then XORing all those individual samples into a single checksum value.
Because the number of 64‑bit words sampled per disk block affects performance, the number of words to sample is tunable at both system and table levels. However, if you change this value for an individual base table, the affected checksum file structures are not recalculated to match the new setting until the next time the block is modified, unless you also specify IMMEDIATE in the checksum option clause of an ALTER TABLE request. The typical applications for the IMMEDIATE option are 1) to turn checksums off for the table in question or 2) to initiate checking immediately when disk array problems have been noted.see “ALTER TABLE” in SQL Data Definition Language.
After an ALTER TABLE request without the IMMEDIATE option has been executed, the file system recalculates checksums only when the file system structure is again written to during the normal activity of database I/Os. At that time, the system recalculates the checksum using the newly specified sample algorithm.