Archiving the log

If you are a properly authorized operator, you can archive the current Db2 active log data sets when necessary by issuing the ARCHIVE LOG command. Using the ARCHIVE LOG command can help with diagnosis by enabling you to quickly offload the active log to the archive log, where you can use DSN1LOGP to further analyze the problem.

Before you begin

You must have either SYSADM authority or have been granted the ARCHIVE privilege.

Procedure

Begin general-use programming interface information. To archive the log:

Enter the following command:
-ARCHIVE LOG

When you issue the preceding command, Db2 truncates the current active log data sets, runs an asynchronous offload, and updates the BSDS with a record of the offload. The RBA that is recorded in the BSDS is the beginning of the last complete log record that is written in the active log data set that is being truncated.

Example

You can use the ARCHIVE LOG command as follows to capture a point of consistency for the MSTR01 and XUSR17 databases:

-STOP DATABASE (MSTR01,XUSR17)
-ARCHIVE LOG
-START DATABASE (MSTR01,XUSR17)

In this simple example, the STOP command stops activity for the databases before archiving the log.

Canceling log offloads

About this task

In some cases, the offload of an active log might be suspended when something goes wrong with the offload process, such as a problem with allocation or tape mounting. If the active logs cannot be offloaded, the Db2 active log data sets become full and Db2 stops logging.

To cancel (and retry) an offload, issue this command:

-ARCHIVE LOG CANCEL OFFLOAD

When you enter the command, Db2 restarts the offload, beginning with the oldest active log data set and proceeding through all active log data sets that need offloading. If the offload fails again, you must fix the problem that is causing the failure before the command can work.End general-use programming interface information.