Every committed UPDATE is useless after a crash unless DB2 can find the matching log records. Those records land first in active logs, then in archive logs after offload. The bootstrap data set (BSDS) is the map of which data sets hold which RBA ranges. This page is the beginner tour of that machinery: dual logging, sizing, SET LOG, truncation, compression, and how recovery reads the same files.
Logging records data changes and significant events as they happen. Restart uses the log to redo committed work and undo uncommitted work. The RECOVER utility uses the log to roll an image copy forward (log apply). Commands after restart are also logged as system events. This is not optional journaling you turn off for speed in production.
| Piece | Role |
|---|---|
| Active logs | Current write target; reused after offload |
| Archive logs | Durable copies of former actives for recovery |
| BSDS | Inventory of logs, RBA/LRSN ranges, checkpoint pointers |
| Dual copies | COPY1/COPY2 logs and dual BSDS against single-point failure |
Db2 writes each log record to a disk VSAM data set called an active log. You define several active log data sets (a ring). When the current data set is full, Db2 switches to the next and offloads the full one. After a successful archive, that active data set can be overwritten on the next cycle.
Active log sizing: too small and you offload constantly (tape mounts, CPU, risk of “all actives full”). Too large and a single media problem loses more history, and offload jobs get huge. IBM: each archive log data set must be at least as large as the active logs. Typical shops use three or more active pairs so offload of one can finish while others accept writes.
If every active log is full and archiving has not completed, update activity does not complete and you may not even be able to stop Db2 cleanly. Monitor offload and archive allocation (including tape units via -SET ARCHIVE).
In dual logging mode Db2 writes the same records to COPY 1 and COPY 2 active logs on separate volumes/control units when possible. A write error on one copy can fall back to single-mode logging; restore dual operation without an outage when you can. Always add NEWLOG data sets in pairs when dual logging is on.
An archive log is the offload target: disk or tape sequential data sets. Archive log sizing follows the active size (at least as large) and your retention: keep archives for as long as you might need to RECOVER from the oldest image copy you still catalog. BSDS records the archive inventory; DSNJU004 (print log map) lists what Db2 thinks it has.
Log compression can reduce archive volume (installation and zparm options). Compressed archives still must be readable by RECOVER on the subsystem that needs them—test restore paths, do not discover compression at the DR site.
-SET ARCHIVE controls how many tape units archive offload may use and how long they stay allocated. Wrong values cause offload delays that fill actives.
The BSDS is a VSAM key-sequenced data set created at installation. It holds:
Dual BSDS means two copies, updated together. If one copy fails, Db2 can continue; -RECOVER BSDS rebuilds the damaged copy from the good one. Print log map (DSNJU004) and change log inventory (DSNJU003) run against the BSDS while Db2 is down (DSNJU003). Never “fix” BSDS with a text editor.
At migration to Db2 12 you cannot start until the BSDS uses the 10-byte RBA and LRSN format. Convert before or during migration.
A log RBA (relative byte address) locates a record in this member’s log. LRSN (log record sequence number) is the data-sharing time-based sequence used across members. Non-data-sharing recovery points are RBAs; data-sharing recovery points are LRSNs. Log records include undo/redo data for pages, checkpoint records, and system events.
DISPLAY LOG shows current active log names, RBA, offload status, and checkpoint parameters.
1234-DISPLAY LOG -SET LOG LOGLOAD(0) /* force a checkpoint, keep current LOGLOAD */ -SET LOG NEWLOG(DSNCAT.LOGCOPY1.DS04) COPY(1) -SET LOG NEWLOG(DSNCAT.LOGCOPY2.DS04) COPY(2)
Log offload copies a completed active log to an archive. You can also truncate the current active log (switch early) so a consistent copy exists—used with SET LOG SUSPEND/RESUME and some backup procedures.
-SET LOG can:
NEWLOG/REMOVELOG changes are pervasive (they survive restart). DSNJU003 remains the tool when Db2 is down or for operations SET LOG cannot do (conditional restart records).
From RECOVER’s point of view, active and archive data sets are simply recovery logs. After restoring an image copy, log apply reads every log record for that object from the copy’s RBA/LRSN to the target point. The BSDS tells RECOVER which data set contains that range. If you discarded an archive that SYSCOPY still needs, recovery fails. MODIFY RECOVERY deletes old SYSCOPY/SYSLGRNX rows—do that only after you accept that older recovery points are gone.
Point-in-time and disaster recovery procedures always start with “are the BSDS and the needed logs at the recovery site?” Image copies without logs only get you to the copy time, not to current.
Active logs are the notebook on the desk. When a notebook is full, you photocopy it into a box in the closet (archive) and reuse the notebook. The BSDS is the list taped to the closet door: which notebook and which box hold which page numbers (RBAs). Dual logging is writing in two notebooks at once so spilling juice on one is not a disaster. Offload stuck with a full desk of notebooks means nobody can write new stories until a box is free.
1. What is the BSDS?
2. When an active log data set fills, Db2:
3. Dual logging means:
4. A log RBA is:
5. Which command can add an active log while Db2 is up (Db2 10+)?