Redo Operation 23 - Physical I/O Operations

23.1 - Block Write Operation

This redo is generated when a DBWn performs a physical block write to the database.

23.2 - Block Read Operation

This operation has been observed when db_lost_write_protect is set to TYPICAL (tested) or FULL (assumed)

When the db_lost_write_protect parameter is set on a primary database, additional redo is generated when a session performs a physical read to the buffer cache. The physical read can be a sequential (single-block) read or a scattered (multi-block) read. The redo includes the DBA for the block and the SCN for the last write.

If the db_lost_write_protect parameter is set on a standby then recovery will stop with a detailed error message if a lost write is detected. Presumably a lost write is detected by performing a physical read from disk on the standby and comparing this to the SCN in the 23.2 redo.

The operation only appears to be generated for reads into the buffer cache. If the read is a direct read into PGA, the 23.2 redo is not generated. Note that this assertion was confirmed by setting the _serial_direct_reads parameter to NEVER and setting db_lost_write_protect to TYPICAL. It is possible (though unlikely) that db_lost_write_protect forces buffered reads for other values of _serial_direct_reads

This redo is generated when a process performs a physical block read from the database.

For a single block read there appear to be two main structures:

The first includes an LWN structure. For example:

REDO RECORD - Thread:1 RBA: 0x000095.00000002.0010 LEN: 0x0060 VLD: 0x14
SCN: 0x0000.003a7c59 SUBSCN:  1 08/26/2015 18:42:22
(LWN RBA: 0x000095.00000002.0010 LEN: 0009 NST: 0001 SCN: 0x0000.003a7c59)
CHANGE #1 TYP:2 CLS:6 AFN:1 DBA:0x0040015a OBJ:37 SCN:0x0000.0007ceeb SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x0040015a BFT:(1024,4194650) non-BFT:(1,346)
              scn: 0x0000.0007ceeb seq: 0x01
              flags: 0x00000006 ( dlog ckval )

The second does not include the LWN structure:

REDO RECORD - Thread:1 RBA: 0x000095.00000002.0070 LEN: 0x0034 VLD: 0x10
SCN: 0x0000.003a7c59 SUBSCN:  1 08/26/2015 18:42:22
CHANGE #1 TYP:2 CLS:6 AFN:1 DBA:0x004048a7 OBJ:228 SCN:0x0000.00024710 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x004048a7 BFT:(1024,4212903) non-BFT:(1,18599)
              scn: 0x0000.00024710 seq: 0x01
              flags: 0x00000006 ( dlog ckval )

The LWN structure is included in the redo record. Without the LWN, the redo record header is 24 bytes; with the LWN the redo record header is 68 bytes.

The VLD flag specifies whether or not the LWN structure exists. If VLD & 0x4 is non-zero, there will be an LWN structure.

In both the above examples, there is a change header, but no change vector or change elements. This is because there is sufficient information in the redo record header and the change header to

For multi-block reads, a redo record can include multiple changes. For example:

REDO RECORD - Thread:1 RBA: 0x000095.00000017.00c4 LEN: 0x00dc VLD: 0x10
SCN: 0x0000.003a7c5d SUBSCN:  1 08/26/2015 18:42:26
CHANGE #1 TYP:0 CLS:4 AFN:1 DBA:0x00415ce1 OBJ:75819 SCN:0x0000.003a2c74 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x00415ce1 BFT:(1024,4283617) non-BFT:(1,89313)
              scn: 0x0000.003a2c74 seq: 0x01
              flags: 0x00000004 ( ckval )
CHANGE #2 TYP:0 CLS:4 AFN:1 DBA:0x00415ce2 OBJ:75819 SCN:0x0000.003a2c74 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x00415ce2 BFT:(1024,4283618) non-BFT:(1,89314)
              scn: 0x0000.003a2c74 seq: 0x01
              flags: 0x00000004 ( ckval )
CHANGE #3 TYP:0 CLS:4 AFN:1 DBA:0x00415ce3 OBJ:75819 SCN:0x0000.003a2c74 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x00415ce3 BFT:(1024,4283619) non-BFT:(1,89315)
              scn: 0x0000.003a2c74 seq: 0x01
              flags: 0x00000004 ( ckval )
CHANGE #4 TYP:0 CLS:4 AFN:1 DBA:0x00415ce4 OBJ:75819 SCN:0x0000.003a2c74 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x00415ce4 BFT:(1024,4283620) non-BFT:(1,89316)
              scn: 0x0000.003a2c74 seq: 0x01
CHANGE #5 TYP:0 CLS:4 AFN:1 DBA:0x00415ce5 OBJ:75819 SCN:0x0000.003a2c74 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x00415ce5 BFT:(1024,4283621) non-BFT:(1,89317)
              scn: 0x0000.003a2c74 seq: 0x01
              flags: 0x00000004 ( ckval )
CHANGE #6 TYP:0 CLS:4 AFN:1 DBA:0x00415ce6 OBJ:75819 SCN:0x0000.003a2c74 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x00415ce6 BFT:(1024,4283622) non-BFT:(1,89318)
              scn: 0x0000.003a2c74 seq: 0x01
              flags: 0x00000004 ( ckval )
CHANGE #7 TYP:0 CLS:4 AFN:1 DBA:0x00415ce7 OBJ:75819 SCN:0x0000.003a2c74 SEQ:1 OP:23.2 ENC:0 RBL:0
 Block Read - afn: 1 rdba: 0x00415ce7 BFT:(1024,4283623) non-BFT:(1,89319)
              scn: 0x0000.003a2c74 seq: 0x01
              flags: 0x00000004 ( ckval )

The above example shows the redo generated for a seven block read. In this case the amount of redo generated (LEN) is 0x00dc (220 bytes). This consists of a 24 byte redo record header plus 7 x 28 byte change headers.

The maximum number of changes that can be included in the redo record appears to be 20. Additional redo records are generated if there are more than 20 changes. Note that the limit of 20 appears to be arbitrary as more than one 512-byte redo block is required to store 20 x 28 byte change headers Note that the limit of 20 appears to be arbitrary as more than one 512-byte redo block is required to store 20 x 28 byte change headers

The flags are stored in the change header (bytes 2 and 3). Known values are:

For single block reads, the redo record header includes an LWN structure, then the size of the redo header is 68 bytes otherwise it is 24 bytes. The size of a change header is 28 bytes. Therefore the total size of a 23.2 redo record for a single block read is either 68 + 28 = 96 bytes (with SCN header) or 24 + 28 = 52 bytes (without SCN header)

For multi-block reads, if a new SCN has been generated, then the size of the redo header is 68 bytes otherwise it is 24 bytes. The size of a change header is 28 bytes per block. So if the operation reads eight contiguous blocks, the amount of redo generated will either be 68 + 28 x 8 = 292 bytes (with SCN header) or 24 + 28 x 8 = 248 (without SCN header).