Phase 4: Backward log recovery

During the fourth restart phase, Db2 changes that were performed for inflight or in-abort units of recovery are reversed.

In phase 4:

  1. Db2 scans the log backward, starting at the current end. The scan continues until the earliest Begin Unit of Recovery record for any outstanding inflight or in-abort unit of recovery.

    If you specified limited backout processing, the scan might stop prematurely (however, Db2 verifies that all catalog and directory changes are completely backed out). In this case, the scan completes after Db2 receives the RECOVER POSTPONED command. You can have Db2 automatically issue this command after restart by specifying the AUTO option for limited backout processing, or you can issue this command manually.

  2. Db2 reads the data or index page for each remaining undo log record. The page header registers the log RBA of the record of the last change to the page.
    • If the log RBA of the page header is greater than or equal to that of the current log record, the logged change has already been made and written to disk, so Db2 reverses it.
    • If the log RBA in the page header is less than that of the current log record, the change has not been made and Db2 ignores it.
  3. Db2 writes redo compensation information in the log for each undo log record, as it does when backing out a unit of recovery. The redo records describe the reversal of the change and facilitate media recovery. They are written under all circumstances, even when:
    • The disk version of the data did not need to be reversed.
    • The page set has pages on the LPL.
    • An I/O error occurred on the disk version of the data.
    • The disk version of the data could not be allocated or opened.
    • The page set is deferred at restart using the DEFER subsystem parameter.
  4. Db2 writes pages to disk as the need for buffers demands it.
  5. Db2 writes to disk all modified buffers that have not yet been written.
  6. Db2 issues message DSNR006I, which summarizes the number of remaining inflight, in-abort, and postponed-abort units of recovery. The number of inflight and in-abort units of recovery should be zero; the number of postponed-abort units of recovery might not be zero.
  7. Db2 marks the completion of each completed unit of recovery in the log so that, if restart processing terminates, the unit of recovery is not processed again at the next restart.
  8. If necessary, Db2 reacquires write claims for the objects on behalf of the indoubt and postponed-abort units of recovery.
  9. Db2 takes a checkpoint after all database writes have been completed.

If Db2 encounters a problem while applying a log record to an object during phase 4, the affected pages are placed in the logical page list. Message DSNI001I is issued once per page set or partition, and message DSNB250E is issued once per page. Restart processing continues.

Db2 issues status message DSNR031I periodically during this phase.