Replication states

The Db2® Mirror replication state needs to be understood and monitored. The replication state indicates whether replication is active, tracking, or blocked.

Replication within database independent auxiliary storage pools (IASPs) is a separate process from replication within SYSBAS. Each database IASP has its own replication state. See Independent auxiliary storage pools for more information about database IASPs.

Active replication state

The normal state for Db2 Mirror is when object replication is active. The Db2 Mirror nodes and/or database IASPs are communicating with each other and are actively sending and receiving updates to replicated objects. When object replication is active, any creates, updates, or deletes of objects included in replication occur on both nodes. When object replication is active, the replication state on both nodes is ACTIVE.

Start of changeWhen Db2 Mirror is configured as a read-only environment, the replication detail on the primary node will be REPLICATING, while the secondary node will have a replication detail of READ-ONLY.End of change

Tracking/blocked replication state

When a node or database IASP is not available, or if communication is interrupted between the nodes, object replication is suspended. This causes Db2 Mirror to go into TRACKING/BLOCKED replication state to prevent conflicting changes to replicated objects. One node is allowed to continue operations affecting replicated objects and its replication state is set to TRACKING. The other node is blocked from making changes to replicated objects and its replication state is set to BLOCKED. The node that is BLOCKED is allowed to make changes to non-replicated objects and can query replicated objects. There are a few exceptions, some changes to replicated objects are permitted on the BLOCKED node. See Object types that allow changes while blocked for details.

Replication role

A replication role of primary or secondary is assigned to each node for SYSBAS and each database IASP included in replication. The primary node designation is used to determine which node is set to TRACKING. The secondary node designation is used to determine which node becomes BLOCKED. During the initial configuration of Db2 Mirror, the setup source node is designated as the primary node and the setup copy node becomes the secondary node. The replication role can be switched by the administrator to control which node allows changes to replicated objects during a planned or unplanned outage.

Database IASPs have a separate replication role from SYSBAS. Typically, the database IASP replication role is the same as the replication role of SYSBAS. When object replication of both SYSBAS and the database IASP are active, then the replication role of the database IASP is the same as the replication role of SYSBAS. When object replication is suspended for SYSBAS, all database IASP object replication is also suspended. Object replication for a single database IASP is suspended by varying off the IASP on one node. When database IASP object replication is suspended, the database IASP replication role is adjusted separately and may differ from the replication role of SYSBAS.

Object Tracking List (OTL)

The Object Tracking List is the mechanism used to track changes when the replication state is not ACTIVE. Since IASPs may have separate state transitions from SYSBAS, there is an OTL for SYSBAS and a separate OTL for each database IASP. Each OTL on a node contains the changes which must be sent to the other node during the resynchronization process.

Suspending replication

The transition from ACTIVE state to TRACKING/BLOCKED state can occur for different reasons.

User initiated suspend

The administrator can suspend replication between the nodes. This will affect replication of SYSBAS and all database IASPs. This might be done for planned maintenance on the secondary node. There are two different types of user initiated suspend:
  1. Suspend - A normal suspend changes the state of the nodes to TRACKING and BLOCKED. Network Redundancy Groups (NRGs) and Db2 Mirror system jobs remain running. Most PTFs can be applied during a normal suspend.
  2. Maintenance - A suspend for maintenance changes the state of the nodes to TRACKING and BLOCKED. NRGs and Db2 Mirror system jobs are ended. Suspending for maintenance is only required in these situations:
    • To perform maintenance on the Network Redundancy Groups (NRGs).
    • To apply and activate a limited set of Db2 Mirror related PTFs. This type of PTF is identified in the Db2 Mirror PTF Group cover letter.

System initiated suspend

A system initiated suspend takes place when a node is powered down or if a node detects that communication is not available with the other node. Based on the replication role of the node that can no longer communicate, it will change its state from ACTIVE to either TRACKING or BLOCKED.

If a database IASP is varied off while both the SYSBAS replication state and the IASP replication state are ACTIVE, the replication state of the IASP that is still varied on will change to TRACKING. User initiated suspends are not supported for IASPs, so varying off the IASP on either node is the recommended process for suspending replication on an IASP without affecting SYSBAS replication.

Resuming replication

Depending on why replication was suspended, resuming replication can also be user or system initiated. If a user initiated the suspend, then the user must also initiate the resume. If the suspend was system initiated, then a resume might automatically occur when the nodes are able to communicate, or it might require user intervention.

Resynchronization

As part of resuming replication, the BLOCKED node must be brought up to date with any changes that occurred on the TRACKING node. Resynchronization is the process by which tracked changes are applied to the other node.

While the nodes are still in TRACKING and BLOCKED state but communicating with each other, the resynchronization process is started. Resynchronization is divided into two phases.
  • Phase one

    Phase one processes all operations other than database I/O and spooled file operations. During phase one, the primary node remains in TRACKING state and the secondary node remains in BLOCKED state.

    By the end of phase one, locks have been acquired on both the primary and secondary nodes to prevent any object definition changes for each database physical file that still requires I/O resynchronization. These locks do not prevent data change operations on the primary node, but applications on the secondary node are prohibited from performing data change operations on a file until the I/O resynchronization on the file is complete. Read-only operations are permitted on the secondary node.

  • Phase two

    Phase two processes database I/O and spooled file operations. During phase two, the primary and secondary nodes are in ACTIVE state. I/O resynchronization is performed concurrently while applications are allowed to access and change replicated objects that do not conflict with the resynchronization.

The Db2 Mirror GUI or the QSYS2.MIRROR_INFO SQL view can be used to monitor the resynchronization status and progress. See Resynchronization for more details