Cache Header and Tail

All datafile blocks are written and read by the cache layer of the Oracle kernel (KCB) generally through the database buffer cache.
The cache layer reads and maintains a 20-byte header and 4-byte tail on each data block, called the cache header and tail.
The cache header is called the common block header in V$TYPE_SIZE and elsewhere.
Controlfile blocks also have a cache header and tail, although not all the fields are used.

This is what the cache header and tail look like in a datablock dump.
(This is taken from a blockdump of the segment header block of the SYSTEM rollback segment.)

The tablespace relative database block address (RDBA).
This is constructed from the tablespace relative file number,
and the block number of the data block within that file.

SCN

6 bytes

The SCN at which the block was last changed.
The low-order 4 bytes are called the SCN base, and the high-order 2 bytes are called the SCN wrap.

sequence

1 byte

A sequence number incremented for each change to a block at the same SCN.
If the sequence number wraps, a new SCN must be allocated.

The value 0xff is reserved.
When present it indicates that the block has been marked as corrupt by Oracle.

flag

1 byte

A combination of 1-bit flag values.
1 = virgin block
2 = last change to the block was for a cleanout operation
4 = checksum value is set
8 = temporary data

format

1 byte

The format of the cache header was changed for Oracle8.
Under Oracle8 and 9, the value is always 2. Previously, it was 1.

checksum

2 bytes

An optional checksum of the block contents.
When a block is written, the checksum is either cleared or set
depending on the setting of the db_block_checksum parameter.
When a block is read, the checksum is verified if present and if the parameter is set to TRUE.
Checksums are always calculated and checked for blocks in the SYSTEM tablespace.

The checksum is the XOR of all the other 2-byte pairs in the block.
Thus when a block with a checksum is checked, the XOR of all the 2-byte words in the block should be 0.

The most common block types is 6, which is used for all table, index and cluster data blocks.

unused

4 bytes

Unused space, possibly for backward or forward compatibility.

The tail is comprised of the low-order two bytes of the SCN base followed by the block type and the sequence number.
The consistency of the header and tail is checked whenever a block is read.
This detects most block corruptions, in particular split blocks from hot backups.

The physical order of the header fields is: block type, format, unused (2 bytes), RDBA, SCN, sequence, flag, checksum, unused (2 bytes).
The following output from BBED (a low level block browser / editor utility)
corresponds to the above extract from a blockdump of the segment header block of the SYSTEM rollback segment.