Every COPY, QUIESCE, LOAD LOG YES, and REORG LOG YES writes a breadcrumb in SYSIBM.SYSCOPY. Log ranges land in directory table SYSIBM.SYSLGRNX. If you never prune those tables, recovery reports get slow and the directory grows. The IBM MODIFY RECOVERY utility is how DB2 for z/OS deletes outdated recovery history—and optionally the image copy data sets themselves.
For indexes defined COPY YES on the target table space, SYSCOPY and SYSLGRNX rows that meet the criteria are deleted automatically. You can recycle Db2 version numbers for reuse as OLDEST_VERSION in SYSTABLESPACE, SYSTABLEPART, SYSINDEXES, and SYSINDEXPART is updated.
DSNDB06.SYSTSCPY, DSNDB01.SYSUTILX, DSNDB01.DBD01, and DSNDB01.SYSDBDXA do not keep SYSCOPY/SYSLGRNX the same way—MODIFY RECOVERY on them deletes nothing from those tables.
UTILINIT, MODIFY (rows deleted), DELETEDS (if specified), UTILTERM. You need IMAGCOPY, database admin authorities, System DBADM, SYSCTRL, or SYSADM. Installation SYSOPR: catalog and directory only.
| Option | Meaning |
|---|---|
| TABLESPACE db.ts | Object whose history is cleaned. Database defaults to DSNDB04. |
| LIST name | LISTDEF of table spaces or partitions only. |
| DSNUM ALL | n | Entire space (default ALL) or one partition/data set (max 4096). |
| CLONE | Clone object history only; LISTDEF CLONED YES is not enough. |
| DELETE AGE / DATE | Delete older than n days or before a date; * means all. |
| RETAIN LAST / LOGLIMIT / GDGLIMIT | Keep recent copies; delete older. |
| FLASHCOPY ONLY | Delete FlashCopy SYSCOPY rows only when an equivalent sequential copy exists. |
| DELETEDS / NOCOPYPEND | Delete copy data sets; do not set COPY-pending if all copies vanish. |
AGE(integer) deletes rows older than that many days (0–32767). Age 0 is today and is not deleted by a numeric AGE. AGE(*) deletes all ages. DATE(yyyymmdd) or six-digit yymmdd (converted to the most recent previous eight-digit date) deletes rows written before that date. DATE(*) deletes regardless of date.
123456789MODIFY RECOVERY TABLESPACE PAYDB.PAYTS DELETE AGE(30); MODIFY RECOVERY TABLESPACE PAYDB.PAYTS DSNUM 2 DELETE DATE(20240101); MODIFY RECOVERY LIST PAYTSLIST DELETE AGE(*) NOCOPYPEND;
FLASHCOPY ONLY deletes FlashCopy SYSCOPY rows only when an equivalent sequential copy (same START_RBA, PIT_RBA, DSVOLSER) exists—typically created by COPY or COPYTOCOPY. It does not delete SYSLGRNX/SYSOBDS, does not update DBDs or versions, and does not insert the ICTYPE='M' STYPE='R' row because recoverability is unchanged.
DSNUM ALL (default) is the whole table space. If you copy by partition and specify DSNUM ALL without a full-space image copy, the space can go COPY-pending. DSNUM integer is one partition or, for nonpartitioned spaces, the data set number from the VSAM name (…Annn). With DSNUM integer, MODIFY RECOVERY will not delete partition SYSCOPY rows whose RBA is newer than the earliest point to which the entire table space could be recovered (full copy, LOAD LOG YES, or REORG LOG YES). A partition in PRO forces RETAIN LAST(2). DSNUM ALL with any PRO partition fails. DSNUM on a partitioned space also cleans partitioned COPY YES index SYSCOPY rows and version numbers—not NPSIs.
If at least one SYSCOPY row is deleted and the object is not recoverable from remaining SYSCOPY rows or system-level backups, Db2 sets COPY-pending unless NOCOPYPEND. After a successful cleanup Db2 often inserts SYSCOPY ICTYPE='M' STYPE='R' for the RBA/LRSN of the most recently deleted row (per partition when run at table-space level). That insert is skipped when no SYSLGRNX rows were deleted or when the only deleted SYSCOPY rows were full copies, concurrent I/J copies, incrementals, or quiesce points.
DELETEDS deletes the cataloged copy data sets that belonged to those SYSCOPY rows (disk, HSM-migrated, sequential, inline, FlashCopy, GDG), even if unexpired.
123456MODIFY RECOVERY TABLESPACE PAYDB.PAYTS RETAIN LAST(3) DELETEDS; MODIFY RECOVERY TABLESPACE PAYDB.PAYTS RETAIN LOGLIMIT;
SYSCOPY is a shoebox of ticket stubs from every time you photocopied a book (image copies) or froze a chapter (quiesce). SYSLGRNX is a list of which diary pages cover each book. MODIFY RECOVERY is throwing away stubs older than your backup policy so the shoebox still closes. DELETE AGE(30) means “stubs older than 30 days.” RETAIN LAST(3) means “keep the last few photocopy days.” DELETEDS also throws away the photocopies in the filing cabinet. If you throw away every photocopy, Db2 sticks a COPY-pending note on the shelf unless you promised NOCOPYPEND—which you should only do for books you can reprint from scratch.
1. What catalog/directory tables does MODIFY RECOVERY clean?
2. What does DELETE AGE(*) do?
3. Why can RETAIN LAST(2) keep more than two copies?
4. When does MODIFY RECOVERY set COPY-pending?
5. Should you run REPORT RECOVERY before MODIFY RECOVERY?