Name

replay — starts the roll forward of the given log

Synopsis

replay ( in log_file varchar );
 

Description

This starts a roll forward of the given log. The log may have been produced by normal transaction logging, backup or crash dump. Logs may not be transferred between databases and thus cannot be rolled forward anywhere except on the database that generated them.

This function is for example useful after restoring a backup. It should be called for each archived transaction log produced since the backup, including and starting with the one that was current when the backup was made.

The operation blocks until the roll forward is complete. Other clients are not affected.

Errors

Parameter data type checking errors

Table 24.76. Errors signalled by

sqlstate error code error text
25000 SR074 replay must be run in a fresh transaction.
42000 FA002 Can't open file <fname>, error <OS errno> (<OS description>)

Parameters

log_file

Full pathname of file containing the transactions to be replayed. The file must be produced by backup .

Return Values

Zero, if no error is signalled.

Examples

Example 24.318. Replaying A Log File

checkpoint 'new.log';
backup 'bak.log';
shutdown 'new2.log';

The above sequence of commands makes a checkpoint and starts logging subsequent transactions into new.log. The backup statement makes bak.log, which represents the state prior to starting new.log. The shutdown statement makes a new checkpoint and marks new2.log as the log file to be used for logging transactions after the database restarts. The database server exits at the completion of the SHUTDOWN statement.

replay ('bak.log');
replay ('new.log');

These statements executed on an empty database will recreate the state in effect after the last transaction to commit before the SHUTDOWN statement of the previous example.


See Also

backup