When z/OS or DB2 stops unexpectedly, restart must answer two questions: which changes were committed, and which were not. The answers live in the log, but Db2 does not reread history from the first IPL. A checkpoint plants a bookmark. Restart recovery walks forward and backward from that bookmark for each unit of recovery (UR). This page explains checkpoints, CHKFREQ/CHKTYPE, UR states, and why COMMIT frequency is a restart-tuning knob.
A system checkpoint is a log record (and related writes) that captures:
The BSDS remembers where the latest checkpoint sits on the log. Restart begins there, not at RBA zero. More frequent checkpoints mean shorter restart and a bit more CPU and write activity. Rare checkpoints mean a long log scan after a crash.
| Setting | Meaning |
|---|---|
| CHKTYPE SINGLE + minutes | CHKFREQ 1–60 = minutes between checkpoints; CHKLOGR/CHKMINS NOTUSED |
| CHKTYPE SINGLE + log records | CHKFREQ 1000–16,000,000 log records (200–999 raised to 1000) |
| CHKTYPE BOTH | CHKLOGR records or CHKMINS minutes, whichever first; CHKFREQ NOTUSED |
Installation fields on the checkpoint panel set these zparms. A CHKFREQ of 500,000 with SINGLE/log-records means “every 500,000 log records,” which might be two minutes at noon and twenty minutes at night. That is why many DBAs prefer a minutes interval in the 2–5 minute range (CHKTYPE SINGLE, CHKFREQ 2–5) or BOTH so a log-record cap still fires during a burst.
-SET LOG can change log-records-between-checkpoints (LOGLOAD) while Db2 is up. LOGLOAD(0) forces a checkpoint now without changing the configured value. DISPLAY LOG shows the current checkpoint scheduling parameters.
123-DISPLAY LOG -SET LOG LOGLOAD(0) -SET LOG LOGLOAD(500000)
Coordinate checkpoint frequency with DWQT/VDWQT. If deferred write thresholds are so high that almost all writes wait for checkpoint, you get I/O spikes and still have a large dirty-page set if Db2 crashes just before the checkpoint.
A unit of recovery is the Db2 name for a commit scope. All SQL changes in that UR commit together or roll back together. An application that never COMMITs holds one giant UR: long locks, huge undo, and ugly restart.
| State | Restart action |
|---|---|
| Inflight | Undo (backward recovery) — not committed |
| In-commit | Redo/complete commit — log says commit started |
| In-abort | Finish abort/undo |
| Indoubt | Wait for coordinator (CICS/IMS/XA); -RECOVER INDOUBT if needed |
| Postponed abort | Retry undo when objects are available |
URCHKTH (zparm) warns when a UR writes more than a threshold of log records without commit—your hunt list for batch jobs that update all night. DISPLAY THREAD shows UR status after a failure.
After an abnormal stop, a normal -START DB2 runs restart recovery automatically:
Read the BSDS, locate the last complete checkpoint, identify active/archive logs needed.
Rebuild in-memory knowledge of open objects and exception states from checkpoint plus later log.
Replay logged committed (and in-commit) changes that might not have reached DASD. Database pages on disk can be older than the log; redo makes them current for committed work.
Walk inflight (and in-abort) URs backward and apply compensating changes so uncommitted work disappears.
Two-phase commit URs that finished phase 1 but not phase 2 stay indoubt until CICS/IMS/XA (or the operator with -RECOVER INDOUBT) decides commit or abort.
This is crash / restart recovery: restore data integrity to the current consistent state. It is not point-in-time recovery (that is the RECOVER utility to an older RBA/LRSN) and not disaster recovery (that is another site’s copies and logs).
A clean STOP DB2 MODE(QUIESCE) lets URs finish; MODE(FORCE) is closer to a crash for remaining threads. Restart after FORCE still runs restart recovery.
Each member checkpoints itself. Member restart recovers that member’s URs. Group restart is the heavier case when the shared group state must be rebuilt. GBP and SCA failures have extra restart paths covered in high availability pages. LRSN, not only RBA, orders log records across members.
A unit of recovery is a Lego spaceship you have not glued yet. COMMIT glues it. Checkpoint is taking a photo of the table: which ships are glued, which are still loose, which boxes are open. If the lights go out, restart looks at the last photo, puts glued ships back together (redo), and dumps the loose bricks back in the box (undo). If you never glue (never COMMIT), the photo shows a mountain of loose bricks and cleanup takes forever.
1. A Db2 system checkpoint is used primarily to:
2. CHKTYPE BOTH means checkpoints occur:
3. An inflight unit of recovery at crash time is:
4. SET LOG LOGLOAD(0) does what?
5. Why do long-running URs hurt restart?