Module 13: DB2 Utilities and Production Support
RECOVER
The RECOVER utility restores a table space from image copies and DB2 logs. It is the utility you run when data is lost, corrupted, or logically damaged - it brings the table space back to the current point or to an earlier point in time.
What is RECOVER
- RECOVER restores table spaces or indexes from image copies taken by the COPY utility.
- It finds the needed copies automatically from the SYSIBM.SYSCOPY catalog table.
- After restoring the copy, it applies log records to roll the data forward to the requested point.
- You can recover a whole table space, a single partition, or a list of table spaces together.
- RECOVER INDEX rebuilds an index from the table data when the index alone is damaged.
How RECOVER works
- First it restores the most recent full image copy of the table space.
- Then it applies any incremental copies taken after that full copy.
- Finally it applies DB2 log records to bring the data up to the current point in time.
- The table space is unavailable to applications while recovery runs.
- Always verify the recovery by running CHECK DATA and checking row counts afterwards.
Point-in-time recovery
- TOCOPY recovers to the point of a specific image copy.
- TORBA or TOLOGPOINT recovers to an exact log position, for example just before a bad batch job ran.
- Recovering to a quiesce point is safest - take a QUIESCE before critical jobs so you have a clean point to return to.
- After a point-in-time recovery, the table space is left in RECOVER pending status until follow-up steps complete.
- Point-in-time recovery of one table space can break referential integrity with related tables - check them too.
Example of a RECOVER control statement:-
//RECOV01 EXEC PGM=DSNUTILB,PARM='DB2S,RECOV01'
//STEPLIB DD DSN=DB2.V12.SDSNLOAD,DISP=SHR
//SYSTSIN DD *
RECOVER TABLESPACE HRDB.HRTSEMP
/*
//SYSPRINT DD SYSOUT=*
