-ARCHIVE LOG (Db2)
The Db2 command ARCHIVE LOG enables a site to close a current active log and open the next available log data set.
- Truncates the current active log data sets
- Starts an asynchronous task to offload the data sets
- Archives previous active log data sets not yet archived
- Returns control to the user (immediately)
When specified with the option MODE(QUIESCE), the ARCHIVE LOG command attempts to quiesce (suspend) all Db2 user update activity on the Db2 active log prior to the offload process. When a system-wide point of consistency is reached (that is, when all currently active update users have reached a commit point), the active log is immediately truncated, and the offload process is initiated. The resulting point of consistency is captured in the current active log before it is offloaded. In a data sharing environment, you can create a system-wide point of consistency only for the entire group.
Abbreviation: -ARC LOG
Environment
This command can be issued from a z/OS® console, a DSN session under TSO, a DB2I panel (DB2 COMMANDS), an IMS or CICS® terminal, or a program using the instrumentation facility interface (IFI).
The ARCHIVE LOG command can also be issued from the z/OS subsystem interface (SSI) to enable automated scheduling systems and other programs to execute the command via supervisor call instruction (SVC) 34.
Data sharing scope: Group or member
Authorization
- ARCHIVE privilege
- Installation SYSOPR authority
- SYSCTRL authority
- SYSADM authority
Db2 commands that are issued from a logged-on z/OS console or TSO SDSF can be checked by Db2 authorization using primary and secondary authorization IDs. A logged-on z/OS user ID must be defined in RACF or a similar security server.
Syntax
Option descriptions
- MODE(QUIESCE)
- Halts
all new update activity by the Db2 subsystem
for a specified period of time and attempts to bring all existing
users to a point of consistency after a commit or rollback. When a
point of consistency is reached and captured in the current active
log data set, the current active log data set is truncated, and another
log data set in the inventory becomes current. Offload processing
then begins with the oldest active log data set and ends with the
active log data set that was truncated.
In a data sharing environment, before archiving logs of any member, this option quiesces all active members of a data sharing group. MODE(QUIESCE) also ensures that each inactive member had successfully quiesced its update activity and resolved any indoubt units of recovery (URs) before the inactive subsystem completed normal termination. If any Db2 subsystem is in a failed state, fails during quiesce processing, or is stopped with outstanding URs, the ARCHIVE LOG command fails, and the remaining active members allow update activity to proceed.
If no indoubt URs exist on all quiesced members, active or inactive, the archive operation can continue for active members in the group. Thus, you can archive logs of a data sharing group normally without forcing all members to be active. The current logs of inactive members are truncated and offloaded after they start.
If a system-wide point of consistency cannot be reached during the quiesce period, which is a length of time you can specify, execution of the ARCHIVE LOG command fails and an error message is issued. In a data sharing environment, the maximum time period applies for the whole group, and if any Db2 subsystem cannot quiesce within the time allowed, the command fails.
If there is no update activity on Db2 data when the command ARCHIVE LOG MODE(QUIESCE) is issued, the active log is truncated and offloaded immediately.- TIME( nnn )
- Specifies
the maximum length of time, in seconds, in which the Db2 subsystem is allowed to attempt a full system
quiesce.
If you do not specify a time, the default is the length of time specified in the field QUIESCE PERIOD of installation panel DSNTIPA.
nnn can range from 001 to 999 seconds. You must allocate an appropriate time period for the quiesce processing or the following events can occur:- The quiesce processing can expire before a full quiesce is accomplished.
- An unnecessary Db2 lock contention can be imposed.
- A timeout can occur.
This option is valid only when used in conjunction with the option MODE(QUIESCE).
- WAIT
- Specifies
whether the Db2 subsystem should
wait until the quiesce processing has completed before returning control
to the invoking console or program, or should return control when
the quiesce processing begins. This option is valid only when used in conjunction with the option MODE(QUIESCE).
- ( NO )
- Specifies that control must be returned to the invoking program
when the quiesce processing begins.
If WAIT(NO) is used, quiesce processing is asynchronous to the user; that is, you can issue additional Db2 commands after the ARCHIVE LOG command returns control to you.
- (YES)
- Specifies that the quiesce processing must complete before returning
control to the invoking console or program.
If WAIT(YES) is used, quiesce processing is synchronous to the user; that is, additional Db2 commands can be issued, but they are not processed by the Db2 command processor until the ARCHIVE LOG command is complete.
- SCOPE
- Specifies
whether the command applies to the entire data sharing group or to
a single member only. The SCOPE option is valid only in a data sharing
environment; the option is ignored in a non-data-sharing environment.
SCOPE cannot be specified if MODE(QUIESCE) is specified; the two keywords
are mutually exclusive.
- (MEMBER)
- Initiates offload processing only for the member from which the command is issued. User update activity is not suspended. If that member, or the entire group, is already archiving, the command fails. This is the default, except when MODE(QUIESCE) is specified.
- (GROUP)
- Initiates offload processing for every member of the Db2 group. User update activity is not suspended. If any member of the group, or the entire group, is already archiving, the command fails.
- CANCEL OFFLOAD
- Cancels any off loading currently in progress and restarts the offload process, beginning with the oldest active log data set that has not been off loaded and proceeding through all active log data sets that need off loading. Any suspended offload operations are restarted.
Usage notes
- Remote site recovery
- The ARCHIVE LOG command is very useful when performing a Db2 backup in preparation for a remote site recovery. For example, the command allows the Db2 subsystem to quiesce all users after a commit point, and capture the resulting point of consistency in the current active log before the archive is taken. Therefore, when the archive log is used with the most current image copy (during an offsite recovery), the number of data inconsistencies will be minimized.
- Simultaneous executions
- The ARCHIVE LOG command cannot be executed if another ARCHIVE LOG command is in progress. Instead, error message DSNJ318I is issued and the command fails. This is true in both data sharing and non-data-sharing environments. For example, in a data sharing environment, the command fails if the data sharing member, or group to which it belongs, is already archiving.
- Available active log space
- ARCHIVE LOG cannot be used when the current active log is the last available active log data set because of the following reasons:
- All available active log space would be used.
- The Db2 subsystem would halt processing until an offload is complete.
- Executing ARCHIVE LOG while STOP DB2 is in progress
-
ARCHIVE LOG without the option MODE(QUIESCE) is permitted when STOP DB2 MODE(QUIESCE) is in progress. However, if an attempt is made to execute the ARCHIVE LOG command when a STOP DB2 MODE(FORCE) is in progress, error message DSNJ315I is issued and the ARCHIVE LOG command is not processed.
ARCHIVE LOG with the option MODE(QUIESCE) is not allowed when a STOP DB2 MODE(FORCE) or STOP DB2 MODE(QUIESCE) is in progress. If an attempt is made to run the ARCHIVE LOG command under these circumstances, error message DSNJ315I or DSNJ316I is issued.
If the system was not fully quiesced (as determined by the number of users which could not be quiesced), error message DSNJ317I is issued and ARCHIVE LOG command processing is terminated. The current active log data set is not truncated and switched to the next available active log data set, and the archive log is not created.
- Canceling log offloads
- It is possible for the offload of an active log to be suspended when something goes wrong with the offload process, such as a problem with allocation or tape mounting. Issuing ARCHIVE LOG CANCEL OFFLOAD interrupts the offload process and restarts the offload. The command causes an abnormal termination of the offload task, which can result in a dump. Use ARCHIVE LOG CANCEL OFFLOAD only if the offload task is no longer functioning, or if you want to restart a previous offload attempt that failed.
- Demand on Db2 resources
- Using the option MODE(QUIESCE) during times of peak activity or during periods in which time is critical causes a significant disruption in the availability of Db2 for all users of Db2 resources.
- Interaction with DISPLAY THREAD
- The command DISPLAY THREAD issues message DSNV400I, indicating that an ARCHIVE LOG MODE(QUIESCE) command is active.
- Quiescing members of a data sharing group
- It is not possible to quiesce a single member of a data sharing group. When MODE(QUIESCE) is specified in a data sharing group, the entire group is quiesced.
- Executing ARCHIVE LOG while logging is suspended
- While logging is suspended by SET LOG SUSPEND, do not use ARCHIVE LOG unless CANCEL OFFLOAD is specified. If logging is suspended, issue SET LOG RESUME to resume logging before issuing ARCHIVE LOG.
- Trace information for commands issued with group scope
- If this command is issued with options that specify group scope in a Db2 data sharing member, it also runs on all other active members. IFICID 090 trace records for other group members can show that the same command was issued by the SYSOPR authorization ID from the 016.TLPKN5F correlation ID, in addition to the trace records from the member where the original command was issued. See Command scope in Db2 data sharing.
Examples
- Example: Truncating the current active log data sets and switching to the next available active log
- The following command truncates the current active log data sets
and initiate an asynchronous job to offload the truncated data sets.
No quiesce processing occurs.
-ARCHIVE LOG
- Example: Initiating the default quiesce period before truncating the active log data sets and switching to the next available active log
- The following command initiates a quiesce period. If all Db2 update activity is stopped within
this period, truncate the current active log data set and switch to
the next available active log data set. Let the value in the field
QUIESCE PERIOD of installation panel DSNTIPA determine the length
of the quiesce period. The MODE(QUIESCE) processing is asynchronous.
-ARCHIVE LOG MODE(QUIESCE)
If the Db2 subsystem can successfully block all update activity before the quiesce period ends, it proceeds to the next processing step. If the quiesce time period is insufficient to successfully quiesce the Db2 subsystem, the active log data sets are not truncated and the archive does not occur.
- Example: Initiating a quiesce period of a specified length before truncating the active log data sets and switching to the next available active log
- The following command initiates a quiesce period. If all Db2 update activity is stopped within
this period, truncate the current active log data set and switch to
the next available active log data set. The maximum length of the
quiesce processing period is seven minutes (420 seconds) and the processing
is synchronous for the entire seven minutes.
-ARCHIVE LOG MODE(QUIESCE) WAIT(YES) TIME(420)
If the Db2 subsystem can successfully block all update activity before the quiesce period ends, it proceeds to the next processing step. If the quiesce time period is insufficient to successfully quiesce the Db2 subsystem, the active log data sets are not truncated and the archive does not occur.
- Example: Quiescing all members of a data sharing group before truncating the active log data sets and switching to the next available active log
- The following command initiates a quiesce period for all members
of the data sharing group. If all Db2 update
activity is stopped within this period, truncate the current active
log data set and switch to the next available active log data set.
Specify a quiesce time period of 10 minutes (600 seconds) to override
the value in the field QUIESCE PERIOD of installation panel DSNTIPA
for member DB1G. If the update activity has not quiesced after the
10 minute quiesce period, the command fails and new update activity
is allowed to proceed.
-DB1G ARCHIVE LOG MODE(QUIESCE) TIME(600)
- Example: Truncating the active log data sets and initiating and offload for a single member of a data sharing group
- In a data sharing environment the following command truncates
the active log data sets for group member DB2G and initiate an asynchronous
job to offload the truncated data sets, without any quiesce processing.
In this example, SCOPE(MEMBER) is used by default.
-DB2G ARCHIVE LOG
- Example: Truncating the active log data sets and initiating and offload for all members of a data sharing group
- The following command truncates the data sets for all members
of the data sharing group and initiate an asynchronous job to offload
the truncated data sets, without any quiesce processing.
-DB2G ARCHIVE LOG SCOPE(GROUP)