DB2 keeps tracks of all the backup, restore, and roll forward operations performed in a file called db2rhist.asc, also known as the recovery history file. There is a recovery history file for each database, and it is stored in the directory where the database resides. The file is automatically updated when any of the following events occurs:
A database or table space is backed up
A database or table space is restored
A database or table space is rolled forward
A table space is created
A table space is altered
A table space is quiesced
A table space is renamed
A table space is dropped
A table is loaded
A table is dropped
A table is reorganized
To see the entries in the recovery history file, use the LIST HISTORY command. For example, to list all the backup operations performed on the SAMPLE database, issue
LIST HISTORY BACKUP ALL FOR sample
The output looks like this:
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ --------- B D 20050529122918001 D D S0000007.LOG S0000007.LOG -------------------------------------------------------------------- Contains 3 tablespace(s): 00001 SYSCATSPACE 00002 USERSPACE1 00003 SYSTOOLSPACE ----------------------------------------------------------------------- Comment: DB2 BACKUP SAMPLE OFFLINE Start Time: 20050529122918 End Time: 20050529122939 Status: A ----------------------------------------------------------------------- EID: 21 Location: d: empSAMPLE.0DB2NODE0000CATN000020050529
For each backup operation performed, an entry like the one shown above is entered in the history file. The following list shows the information recorded and includes the corresponding information from the preceding output.
The time of the operation: 20050529122918001
The command used: DB2 BACKUP SAMPLE OFFLINE
The table spaces that were backed up: SYSCATSPACE, USERSPACE1, and SYSTOOLSPACE
The location of the backup image: d: empSAMPLE.0DB2NODE0000CATN0000 20050529
If an error occurred during the operation, the error will be recorded as well.
With the recovery history file, you can easily track all the backup operations, restore operations, and more.