REPAIR is the utility you reach for when SQL cannot touch the bytes (space map pages, index entries, catalog/directory) or when a pending flag must be turned off after the real fix. IBM’s first sentence after the introduction is the important one: be extremely careful. Improper REPAIR can damage DB2 data further. This page covers LOCATE, DUMP, VERIFY, REPLACE, DELETE, SET pending states, VERSIONS, index and catalog repair, and DBD operations.
Documented uses include:
Output is one or more modified pages plus dumps. Pages on the logical page list (LPL) cannot be accessed by REPAIR—recover them first. If a page’s log RBA is higher than the current end of log (truncated log), Db2 will not allow modification until DSN1COPY RESET (or equivalent IBM procedure) is applied.
This is the form most operators know. It does not fix RI violations or rebuild keys; it only clears (or sets) the flag.
| Keyword | Pending state |
|---|---|
| NOCHECKPEND | Reset CHECK-pending (CHKP) |
| NORBDPEND | Reset REBUILD-pending (RBDP) |
| NOCOPYPEND | Reset COPY-pending (COPY) |
| NORCVRPEND | Reset RECOVER-pending (RECP) |
| NOAUXCHKP | Reset auxiliary CHECK-pending |
| NOAUXWARN | Reset auxiliary-warning (AUXW) |
| NOAREORPEND | Reset advisory REORG-pending (AREO*) |
| PRO / NOPRO | Turn persistent read-only on or off |
1234REPAIR SET TABLESPACE PAYDB.PAYTS NOCHECKPEND REPAIR SET TABLESPACE PAYDB.PAYTS PART 4 NOAUXCHKP REPAIR SET INDEX (ALL) TABLESPACE PAYDB.PAYTS NORBDPEND REPAIR SET TABLESPACE PAYDB.PAYTS NOPRO
Prefer CHECK DATA / CHECK LOB / REBUILD INDEX / COPY to clear CHKP, AUXW, RBDP, and COPY the honest way. Use SET when the utility already succeeded but the flag stuck, or IBM Support instructs you to reset a stale state.
LOCATE names where. Then DUMP, VERIFY, REPLACE, or DELETE say what. Always DUMP first, VERIFY the old value, REPLACE the new value, DUMP again.
| LOCATE | Targets |
|---|---|
| PAGE X'nn' [PART n] | A specific page (and partition) in a table space or index |
| RID(X'...') | A row in a table space by row identifier |
| KEY … INDEX(creator.ix) | Locate via index key |
| ROWID / VERSION | LOB table space locate |
| DOCID | XML table space locate |
| Action | Meaning |
|---|---|
| DUMP | Hex dump: OFFSET, LENGTH, PAGES; LOB MAP/DATA |
| VERIFY OFFSET DATA | Confirm current bytes before you change them |
| REPLACE OFFSET DATA [RESET] | Overlay bytes; RESET can clear bits as documented for that context |
| DELETE [DATAONLY] | Delete a row or an entire LOB; DATAONLY limits what is removed |
123456789REPAIR OBJECT LOCATE TABLESPACE DSN8D81A.DSN8S81D PAGE X'02' VERIFY OFFSET 50 DATA X'0A00' REPLACE OFFSET 50 DATA X'0D11' DUMP OFFSET 50 LENGTH 4 REPAIR OBJECT LOCATE TABLESPACE PAYDB.PAYTS RID(X'0000000503') DELETE
SHRLEVEL CHANGE is available on current releases so some LOCATE work can run with concurrent access; dumps still take locks (S for DUMP, SIX-class locks for REPLACE in classic descriptions). Treat production REPLACE as a change-controlled event with a backout RECOVER point.
You can LOCATE INDEXSPACE or INDEX and DUMP/REPLACE index pages, or SET INDEX … NORBDPEND. Broken unique indexes are usually REBUILD INDEX, not a hand zap of a leaf page. If you DELETE a table row with REPAIR, matching index entries may still exist until you REBUILD or REPAIR the index too—that is how you create CHECK INDEX failures.
CHECK LOB SHRLEVEL CHANGE can punch REPAIR statements that DELETE invalid LOBs. LOCATE with ROWID and VERSION targets a LOB; DOCID targets XML. You can dump LOB map versus data pages. After deleting a LOB, run CHECK DATA on the base so the column is marked invalid.
Catalog tables cannot be updated with SQL. REPAIR (and IBM recovery procedures) are how you fix catalog/directory inconsistencies. REPAIR VERSIONS TABLESPACE aligns version numbers after DSN1COPY or recovery left SYSTABLES.VERSION at 0 while the space is at a later CURRENT_VERSION. INSERTVERSIONPAGES (with SETCURRENTVERSION on current releases) inserts missing system pages for version-0 format objects.
Run DBD TEST before REBUILD. Do this only with a tested procedure; the directory (DSNDB01) is not a sandbox.
Most Db2 tools rearrange whole shelves. REPAIR is a pair of tweezers and a marker pen. DUMP is taking a photo of one page in the book. VERIFY is checking the photo still matches before you write. REPLACE is writing new letters in that spot. DELETE is tearing out one page. SET is peeling a warning sticker off the shelf without fixing why the sticker was there. Tweezers are great for a splinter and terrible for rebuilding the library—use RECOVER and REBUILD for that.
1. What is the safest everyday use of REPAIR?
2. What does VERIFY do before REPLACE?
3. Which LOCATE identifies a base-table row by internal row ID?
4. REPAIR SET NOCHECKPEND does what?
5. Can REPAIR touch pages on the LPL?