Automatic Incremental Restore Example To restore
a set of incremental backup images using automatic incremental restore, specify
the TAKEN AT timestamp option on the RESTORE DATABASE command. Use the time
stamp for the last image that you want to restore. For example:
db2 restore db sample incremental automatic taken at 20031228152133
This will result in the DB2 restore utility performing each of the steps
described at the beginning of this section automatically. During the initial
phase of processing, the backup image with time stamp 20001228152133 is read,
and the restore utility verifies that the database, its history, and the
table space definitions exist and are valid.
During the second phase
of processing, the database history is queried to build a chain of backup
images required to perform the requested restore operation. If, for some
reason this is not possible, and DB2 is unable to build a complete chain
of required images, the restore operation terminates, and an error message
is returned. In this case, an automatic incremental restore will not be possible,
and you will have issue the RESTORE DATABASE command with the INCREMENTAL
ABORT option. This will cleanup any remaining resources so that you can proceed
with a manual incremental restore.
Note: It is highly recommended
that you not use the FORCE option of the PRUNE HISTORY command. The default
operation of this command prevents you from deleting history entries that
might be required for recovery from the most recent, full database backup
image, but with the FORCE option, it is possible to delete entries that are
required for an automatic restore operation.
During the third phase
of processing, DB2 will restore each of the remaining backup images in the
generated chain. If an error occurs during this phase, you will have to issue
the RESTORE DATABASE command with the INCREMENTAL ABORT option to cleanup
any remaining resources. You will then have to determine if the error can
be resolved before you re-issue the RESTORE command or attempt the manual
incremental restore again.
Manual Incremental Restore Example To restore
a set of incremental backup images, using manual incremental restore, specify
the target image using the TAKEN AT timestamp option of the RESTORE DATABASE
command and follow the steps outlined above. For example:
db2 restore database sample incremental taken at <ts>
where:
<ts> points to the last incremental backup image (the target image) to be restored.
db2 restore database sample incremental taken at <ts1>
where:
<ts1> points to the initial full database (or table space) image.
db2 restore database sample incremental taken at <tsX>
where:
<tsX> points to each incremental backup image in creation sequence.
Repeat Step 3, restoring each incremental backup image up to and including image <ts>.
If you are performing a database restore operation,
and table space backup images have been produced, the table space images
must be restored in the chronological order of their backup time stamps.
The db2ckrst utility
can be used to query the database history and generate a list of backup image
time stamps needed for an incremental restore. A simplified restore syntax
for a manual incremental restore is also generated. It is recommended that
you keep a complete record of backups, and only use this utility as a guide.