Sample scripts and commands for rollforward recovery of the TSLM database (tslmdbrestore.sh and tslmdbrollforward.sh)

TSLM comes with sample scripts that contain operations to fully restore and recover the TSLM database. After restoring the database (sample script tslmdbrestore.sh), you must perform a rollforward operation to complete restoring the database (sample script tslmdbrollforward.sh).

Before you start the restore and recovery process, observe these prerequisites:
  1. Make a backup copy of the database backup file and archive log directories.
  2. Ensure that there is only the latest backup file available in the database backup directory, and that the log files are available in the archive log directory.
  3. Ensure that TSLM is stopped.
For example,
su – ermm
ermmStop
tslmdbrestore.sh
tslmdbrollforward.sh

DB2 commands

You can use DB2® commands to restore the database, then apply a rollforward operation to fully recover the database. The rollforward command triggers the userexit routine to retrieve each log file from the archive since the last backup. Every committed transaction will be inserted into the database. After finishing rollforward, the database recovery is completed.

  1. First, use the restore to restore the database:
    db2 restore database ermm from /opt/IBM/ermm/ermmdbarchive/dbbackup
  2. Next, apply a rollforward operation:
    1. This command applies a rollforward operation to the end of logs:
      db2 rollforward database ermm to end of logs and complete
    2. This command applies a rollforward operation to a defined point-in-time:
      db2 rollforward database ermm to <timestamp> using local time and complete
      where <timestamp> is in yyyy-mm-dd-hh.mm.ss.nnnnnn format.

Handling corrupted logs with a split rollforward command

During a crash recovery, you might encounter corrupted logs. You can handle corrupted logs by splitting the rollforward command into two parts. This way, a corrupted log file can get exchanged for a non-corrupted log file from your system archive before the command completes. The first rollforward command part is to a defined point, and the second part (complete) finishes the command and resets all internal database flags to a normal state. Here is an example of a split rollforward command:
  1. db2 rollforward database ermm to end of logs
  2. db2 rollforward database ermm complete
Note: You can get more information about the current status of the database by issuing the following DB2 command:
db2 rollforward database ermm query status

For more information about the rollforward command, refer to your DB2 Command Reference.