Rollforward overview
You cannot recover transactions that occurred after backup image creation by using the restore tools. Instead, you can recover transactions that have occurred since the last backup command was completed by using rollforward commands. You must enable database logging for these commands to be effective.
db2 ROLLFORWARD DB sample
In IBM® Data Studio Version 3.1 or later, you can use the task assistant for rolling forward databases. Task assistants can guide you through the process of setting options, reviewing the automatically generated commands to perform the task, and running these commands. For more details, see Administering databases with task assistants.
- Invoke the rollforward utility without the STOP option.
- Invoke the rollforward utility with the QUERY STATUS option
If you specify recovery to the end of the logs, the QUERY STATUS option can indicate that one or more log files are missing, if the returned point in time is earlier than you expect.
If you specify point-in-time recovery, the QUERY STATUS option helps you to ensure that the rollforward operation completes at the correct point.
- Invoke the rollforward utility with the STOP option. After the operation stops, it is not possible to roll additional changes forward.
- Invoke the rollforward utility with the AND STOP option.
- The need to take further steps depends on the outcome of the rollforward
operation:
- If it is successful, the rollforward is complete and the database is connectable and usable. At this point, it is not possible to roll additional changes forward.
- If any errors were returned, take whatever action is required to fix the problem. For example, if there is a missing log file: find the log file, or if there are retrieve errors: ensure that log archiving is working. Then reissue the rollforward utility with the AND STOP option.
A database must be restored successfully (using the restore utility) before it can be rolled forward, but a table space does not. A table space can be temporarily put in rollforward pending state, but not require a restore operation to undo it (following a power interruption, for example).
If the database is in rollforward pending state, the database is rolled forward. Any table spaces that were restored from backup images that were taken after the database backup image, and are currently in rollforward pending state are also rolled forward. Any table spaces that were taken prior to the database level backup and restored after the database level backup was restored remain in rollforward pending state. You must issue a subsequent table space level rollforward to recover them.
- If the database is not in rollforward pending state, but
table spaces in the database are in rollforward pending state:
- If you specify a list of table spaces, only those table spaces are rolled forward.
- If you do not specify a list of table spaces, all table spaces that are in rollforward pending state are rolled forward.
A database rollforward operation runs offline. The database is not available for use until the rollforward operation completes successfully, and the operation cannot complete unless the STOP option was specified when the utility was invoked.
A table space rollforward operation can run offline. The database is not available for use until the rollforward operation completes successfully. This occurs if the end of the logs is reached, or if the STOP option was specified when the utility was invoked.
You can perform an online rollforward operation on table spaces, as long as SYSCATSPACE is not included. When you perform an online rollforward operation on a table space, the table space is not available for use, but the other table spaces in the database are available.
db2 rollforward db mydb to end of logs
Rollforward Status
Input database alias = mydb
Number of members have returned status = 3
Member ID Rollforward Next log Log files processed Last committed transaction
status to be read
--------- ------------ ------------ ------------------------- --------------------------
0 DB working S0000001.LOG S0000000.LOG-S0000000.LOG 2009-05-06-15.28.11.000000 UTC
1 DB working S0000010.LOG S0000000.LOG-S0000009.LOG 2009-05-06-15.28.20.000000 UTC
2 DB working S0000005.LOG S0000000.LOG-S0000004.LOG 2009-05-06-15.27.33.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.