3/23/2007

DB2 LOGRETAIN

I think most of you is familiar with the ON/OFF/RECOVERY/CAPTURE, but do you know the difference?

OFF --- circular logging, no log retain, no rollforward, no online backup
|
\ /
CAPTURE -- line logging, log retain, no rollforward, no online backup
|
\ /
ON/RECOVERY -- line logging, log retain, no rollforward, no online backup


Jone Casey gives a summary as below:
"let's quickly review the LOGRETAIN options to make sure you understand the functions and requirements of each option. This discussion is intended to help you determine whether the LOGRETAIN value of CAPTURE is appropriate for your environment. Also, a good understanding of SQL replication is assumed (see the Resources section).

The default value for the LOGRETAIN parameter is NO. The NO option provides support for logical unit of work backout, but does not provide support for roll-forward recovery. The log files are managed in a circular manner. This option can be set by either the UPDATE DATABASE CONFIGURATION command or through the DB2 Control Center.

The other documented option for LOGRETAIN is RECOVERY. The RECOVERY option provides support for both logical unit of work backout and roll-forward recovery. The log files are retained to support roll-forward recovery, and you must manage the storage and disposition of the log files. This option can be set by either the UPDATE DATABASE CONFIGURATION command or through the DB2 Control Center. When you change the LOGRETAIN option to RECOVERY, you must take a database backup before the database is usable.

The third and undocumented option for the LOGRETAIN parameter is CAPTURE. The CAPTURE option provides support for logical unit of work backout, but does not provide support for roll-forward recovery. The difference between the NO and CAPTURE options is in how the log files are managed. With the CAPTURE option, the log files are retained so that the DB2 SQL replication Capture program can read changes from the log files. This option does not require a database backup, and the log files need only be retained until the SQL replication program Capture finishes processing the changes contained in the log files. Also, you can only set this option with the UPDATE DATABASE CONFIGURATION command."
by Jone Casey, "Manage DB2 log files in an SQL replication environment"