This document describes how to archive log files in the active log directory of the DB2 database, and describes how to use the USEREXIT program to manage log files for your reference, hope to help you.
Requirement Description
Because the LOGRETAIN = ON database configuration is used, the database log files will not be automatically deleted or recycled by the database from the active log directory, and more log files will be stored in the active log directory, therefore, you need to archive the log files in this directory.
Problem Analysis
After you set LOGRETAIN to ON, the database supports rollback and recovery. There are three types of log files in the system:
Activity Log: This log contains information about transaction units that have not been committed or rolled back, and the transaction information that has been committed but has not been written into the database file.
Online archiving log: all changes in the activity log are not required for normal processing, that is, when the transactions recorded in the log have been committed and written to the database file, this activity log is converted to online archived logs. They are called online because they are stored in the same directory as activity logs.
Offline archiving logs: these logs are archived offline by copying them from the active log directory to another place. These logs may still be required during database rollback and recovery.
You can manually manage database logs (manually copy online archived logs to an archive directory) or compile the USEREXIT program for automatic maintenance.
DB2 provides the USEREXIT sample program for all platforms and is easy to modify and use. Therefore, IBM recommends that you use the USEREXIT program to manage log files.