Using rollforward

Use the ROLLFORWARD DATABASE command to apply transactions that were recorded in the database log files to a restored database backup image or table space backup image.

Before you begin

You should not be connected to the database that is to be rollforward recovered. The rollforward utility automatically establishes a connection to the specified database, and this connection is terminated at the completion of the rollforward operation.

About this task

Do not restore table spaces without canceling a rollforward operation that is in progress. Otherwise, you might have a table space set in which some table spaces are in rollforward in progress state, and some table spaces are in rollforward pending state. A rollforward operation that is in progress only operates on the tables spaces that are in rollforward in progress state.

The database can be local or remote.

The following restrictions apply to the rollforward utility:
  • You can invoke only one rollforward operation at a time. If there are many table spaces to recover, you can specify all of them in the same operation.
  • If you have renamed a table space following the most recent backup operation, ensure that you use the new name when rolling the table space forward. The previous table space name is not recognized.
  • You cannot cancel a rollforward operation that is running. You can only cancel a rollforward operation that has completed, but for which the STOP parameter has not been specified, or a rollforward operation that has failed before completing.
  • You cannot continue a table space rollforward operation to a point in time, specifying a time stamp that is less than the previous one. If a point in time is not specified, the previous one is used. You can issue a rollforward operation that ends at a specified point in time by just specifying STOP, but this is only allowed if the table spaces involved were all restored from the same offline backup image. In this case, no log processing is required. If you start another rollforward operation with a different table space list before the in-progress rollforward operation is either completed or cancelled, an error message (SQL4908) is returned. Invoke the LIST TABLESPACES command on all database partitions (or use the MON_GET_TABLESPACE table function) to determine which table spaces are currently being rolled forward (rollforward in progress state), and which table spaces are ready to be rolled forward (rollforward pending state). You have three options:
    • Finish the in-progress rollforward operation on all table spaces.
    • Finish the in-progress rollforward operation on a subset of table spaces. (This might not be possible if the rollforward operation is to continue to a specific point in time, which requires the participation of all database partitions.)
    • Cancel the in-progress rollforward operation.
  • In a partitioned database environment, the rollforward utility must be invoked from the catalog partition of the database.
  • Point in time rollforward of a table space was introduced in Db2® Version 9.1 clients. You should upgrade to version 11.1 any clients in order to roll a table space forward to a point in time.
  • You cannot roll forward logs from a different release version.

Procedure

To invoke the rollforward utility, use the:
  • ROLLFORWARD DATABASE command, or
  • db2Rollforward application programming interface (API).
  • Open the task assistant inIBM® Data Studio for the ROLLFORWARD DATABASE command.

Example

The following is an example of the ROLLFORWARD DATABASE command issued through the CLP:

db2 rollforward db sample to end of logs and stop