Recovering a database using a Storage Checkpoint

Because Storage Checkpoints record the before images of blocks that have changed, you can use them to do a file-system-based storage rollback to the exact time when the Storage Checkpoint was taken. You can consider Storage Checkpoints as backups that are online, and you can use them to roll back an entire database. Rolling back to or restoring from any Storage Checkpoint is generally very fast because only the changed data blocks need to be restored.

Suppose a user deletes a table by mistake right after 4:00 p.m., and you want to recover the database to a state just before the mistake. You created a Storage Checkpoint (Checkpoint_903937870) while the database was running at 11:00 a.m., and you have the LOGRETAIN and/or USEREXIT database configuration parameters enabled.

To recover the database using a Storage Checkpoint

  1. Ensure that the affected database is inactive, and use Storage Rollback to roll back the database from the Storage Checkpoint you created at 11:00 a.m.:

    $ /opt/VRTS/bin/db2ed_ckptrollback -I db2inst1 -D PROD \
    -c Checkpoint_903937870

    In a DB2 UDB EEE or ESE environment, db2ed_ckptrollback_all can be used to roll back a partitioned DB2 database to a checkpoint. The db2ed_ckptrollback_all command calls db2ed_ckptrollback on every partition.

  2. Start up the instance if it is down:

    $ db2start
  3. To re-apply archive logs to the point before the table was deleted to recover the database to 4:00 p.m, enter:

    $ db2 rollforward database PROD to isotime

    where ISOTIME is the point in time where all committed transactions are to be rolled forward. The time must be expressed in local time or Coordinated Universal Time (UTC). The UTC format is yyyy-mm-dd-hh.mm.ss.nnnnnn (year, month, day, hour, minutes, seconds, microseconds).

  4. To complete the roll forward, enter:

    $ db2 rollforward database PROD complete