The simplest form of the DB2 ROLLFORWARD DATABASE command requires
only that you specify the alias name of the database that you want
to rollforward recover. For example:
db2 rollforward db sample to end of logs and stop
In this example, the command returns:
Rollforward Status
Input database alias = sample
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = -
Last committed transaction = 2001-03-11-02.39.48.000000
DB20000I The ROLLFORWARD command completed successfully.
For rolling forward databases, you can
use the task assistant available in IBM® Data Studio Version
3.1 or later. 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.
The following is one approach you can use to perform rollforward
recovery:
- 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 is missing, if the returned
point in time is earlier than you expect.
If you specify
point-in-time recovery, the QUERY STATUS option will help you to ensure
that the rollforward operation has completed 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.
An alternate approach you can use to perform rollforward recovery
is the following:
- 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
will be 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 logfile, 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).
When the rollforward utility is invoked:
- If the database is in rollforward pending state, the database
is rolled forward. If table spaces are also in rollforward pending
state, you must invoke the rollforward utility again after the database
rollforward operation completes to roll the table spaces forward.
- 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.
When you first create a database, it is enabled for circular logging
only. This means that logs are reused, rather than being saved or
archived. With circular logging, rollforward recovery is not possible:
only crash recovery or version recovery can be done. Archived logs
document changes to a database that occur after a backup was taken.
You enable log archiving (and rollforward recovery) by setting the
logarchmeth1 database configuration parameter
to a value other than its default of
OFF. When
you set
logarchmeth1 to a value other than
OFF,
the database is placed in backup pending state, and you must take
an offline backup of the database before it can be used again.
Note: Entries
will be made in the recovery history file for each log file that is
used in a rollforward operation.