RECOVER restores DB2 for z/OS data from image copies and then applies the log. You can go to current, to a specific copy, or to a log point (RBA or LRSN). This page covers TABLESPACE, INDEX, DATABASE, partitions, recover-to options, SHRLEVEL, dependencies, and the SYSCOPY history that makes it possible.
The largest everyday unit is a table space or index; the smallest is a page. Name objects explicitly:
1234RECOVER TABLESPACE HRDB.HRTS RECOVER INDEX HR.XEMP1 RECOVER TABLESPACE HRDB.HRTS DSNUM 3 RECOVER DATABASE HRDB
This RECOVER utility is not -RECOVER BSDS or -RECOVER INDOUBT. Those are operator commands on a different page.
With no TOCOPY/TORBA/TOLOGPOINT, RECOVER restores the latest usable full copy, merges incrementals, then applies log until the object is current. That is the path after media failure: DASD gone, copies and logs intact. Phases you will see in SYSPRINT:
| Phase | Role |
|---|---|
| UTILINIT | Setup |
| RESTORE | Locate/merge sequential copies and restore pages |
| LOGAPPLY / related log phases | Apply log from copy RBA/LRSN toward the target |
| LOGCSR / LOGUNDO | For PIT: complete/abort URs so the PIT is consistent |
| Option | Meaning |
|---|---|
| (none) | Recover to current: restore copies, apply all later log |
| TOCOPY dsname | Stop at that image copy (use SHRLEVEL REFERENCE copies) |
| TOLASTCOPY / TOLASTFULLCOPY | Last (full) copy registered in SYSCOPY |
| TORBA X'rba' | Point-in-time at that RBA |
| TOLOGPOINT X'lrsn' | Point-in-time at that LRSN (data sharing clock) |
12345678910RECOVER TABLESPACE HRDB.HRTS INDEX HR.XEMP1 TOLOGPOINT X'00000000000000000000' * use the real LRSN from QUIESCE / SYSCOPY RECOVER TABLESPACE HRDB.HRTS TORBA X'000000000000' RECOVER TABLESPACE HRDB.HRTS TOCOPY HR.COPY.HRTS.G0005V00
After PIT, RECOVER may set COPY-pending, CHECK-pending, or REBUILD-pending on related objects you did not include. Always recover a table space set (parents and children) and indexes together to the same QUIESCE point.
An RBA (relative byte address) locates a position in a non-data-sharing log. An LRSN (log record sequence number) is the data-sharing clock.TOLOGPOINT is the keyword you should default to in a data sharing group; TORBA remains common on standalone subsystems. Both take a hex string.
There is no RECOVER TO TIMESTAMP keyword. Operational practice:
Wall-clock “Tuesday 14:07” is meaningless to RECOVER until you translate it into a log point.
RECOVERYDDN is specified on COPY (and MERGECOPY / COPYTOCOPY), not as the main recover syntax. It creates the remote-site sequential copies. At the DR site, RECOVER reads SYSIBM.SYSCOPY (restored with the catalog) and allocates those data sets. Local recover uses COPYDDN copies. LOGONLY skips RESTORE when the VSAM data sets are already restored from a system-level backup or FlashCopy and you only need log apply.
Classic recover needs the object not in use (often STOP or UTUT). Later Db2 releases added SHRLEVEL CHANGE recover paths that restore to a shadow and switch, similar in spirit to online REORG. Restrictions apply (object types, PIT versus current). Until your shop standardizes on online recover, treat recover as an outage window: STOP the space, RECOVER, START, RUNSTATS if needed.
MODIFY RECOVERY deletes old SYSCOPY rows and SYSLGRNX ranges. Run it on a schedule, but never delete the last full copy you still need. REPORT RECOVERY is the rehearsal.
1234567SELECT TIMESTAMP, ICTYPE, ICBACKUP, DSNUM, DSNAME, HEX(START_RBA) AS START_RBA, SHRLEVEL FROM SYSIBM.SYSCOPY WHERE DBNAME = 'HRDB' AND TSNAME = 'HRTS' ORDER BY TIMESTAMP DESC WITH UR;
ICTYPE values you will learn: F full, I incremental, Q quiesce, S Load/Reorg inline, and others in the SQL Reference. ICBACKUP distinguishes local versus recovery-site copies. Keep this query in the runbook next to the RECOVER job.
123456//RECOVER EXEC DSNUPROC,SYSTEM=DB2T,UID='HR.RECV.HRTS' //SYSPRINT DD SYSOUT=* //SYSIN DD * RECOVER TABLESPACE HRDB.HRTS INDEX HR.XEMP1 /*
Imagine a LEGO castle. COPY took photographs (image copies). The diary (the log) wrote down every brick that moved afterward. RECOVER builds last night’s photograph, then reads the diary until “now” (recover to current) or until a bookmark in the diary (RBA / LRSN) or until a particular photograph (TOCOPY). A QUIESCE bookmark means everyone put their hands in their laps so the castle and the little flag (the index) match. A timestamp is just the clock on the wall—you still have to find the matching diary page. RECOVERYDDN is the photo album stored at grandma’s house for when your house floods.
1. What does RECOVER do by default (no TORBA/TOCOPY)?
2. TORBA versus TOLOGPOINT:
3. Why is a QUIESCE a good PIT?
4. RECOVERYDDN is primarily an option of:
5. TOCOPY of a SHRLEVEL CHANGE copy can: