Replication state

The replication state indicates whether replication is active, tracking, or blocked.

There are several ways to display the replication state and other details about the Db2® Mirror environment. Here are three of them.

  1. The following figure shows the home page for the Db2 Mirror GUI.
    Figure 1. GUI showing active replication
    GUI showing active replication
  2. This figure shows the home page of the Db2 Mirror GUI with the IASP1 database IASP selected from the bottom of the panel.
    Figure 2. GUI showing active replication of an IASP
    GUI showing active replication of an IASP
  3. You can also query the MIRROR_INFO view for SYSBAS and the registered database IASPs. In this example some of the columns relating to replication state are selected.
    SELECT IASP_NAME, REPLICATION_STATE,
            REPLICATION_DETAIL, REPLICATION_DETAIL_INFO,
            REPLICATION_DETAIL_INFO_TEXT,
            PRIMARY_NODE, SECONDARY_NODE
        FROM QSYS2.MIRROR_INFO;
    Figure 3. MIRROR_INFO view showing active replication
    MIRROR_INFO view showing active replication

Role

The role of primary and secondary only matters when the two nodes cannot communicate. The node with the role of primary will be allowed to continue making changes to replicated objects. The updates will be tracked so that when communication resumes, those updates can be sent to the secondary node. The node with the role of secondary will be blocked from making changes to replicated database objects and most other replication-eligible objects.

In GUI showing active replication, the role is displayed above the icon for the node. In MIRROR_INFO view showing active replication, the primary and secondary node are columns that can be included in the query of QSYS2.MIRROR_INFO.

A subset of replication-eligible objects can be changed from the secondary node regardless of the replication state. These exceptions are described in Object types that allow changes while blocked. Those changes are tracked on the secondary node and are resynchronized with the primary node when communication resumes.

State

The replication state is the current state of replication between the two nodes. There is a separate replication state for SYSBAS and for each registered database IASP.

There are four states.
NOT MIRRORED
The node or IASP has not completed its initial configuration. If active replication is terminated, this state also applies. When the state is NOT MIRRORED, the two nodes are independent and no object changes are replicated.
ACTIVE
The Db2 Mirror nodes and/or database IASPs are communicating with each other and are actively sending and receiving updates to replicated objects. Start of changeIn a read-only environment, replication operations can only be initiated from the primary node.End of change
TRACKING
This state is reported on the primary node when communication between the nodes is suspended. This state applies to an IASP when the IASP on the other node is varied off. Changes to replicated objects are allowed on this node or IASP, and those changes will be tracked by Db2 Mirror. Tracked changes are used to resynchronize the nodes when replication resumes. Once resynchronization is complete, the state will change to ACTIVE.
BLOCKED
This state is reported on the secondary node when replication cannot occur. This state applies to an IASP when changes have been tracked on the other node and phase one of resynchronization has not completed. In general, replicated objects can be referenced but not changed until communication resumes. Once phase one of resynchronization is complete, the state will change to ACTIVE.
There are some precedence rules between SYSBAS and database IASPs regarding state.
  • If the IASP is not varied on, the replication state is not reported. The replication state will be determined when the IASP is next varied on.
  • If the replication state of SYSBAS is NOT MIRRORED, the state of all varied on IASPs will also be NOT MIRRORED.
  • If the replication state of SYSBAS is TRACKING or BLOCKED, the replication state of the IASP cannot be ACTIVE. It is possible for SYSBAS to be in TRACKING state and an IASP on the primary node to be in BLOCKED state or vice versa if the IASP had been varied off on one node and had not finished its resynchronization process before the SYSBAS state changed.
  • If the replication state of SYSBAS is ACTIVE, any state for the IASP is possible. It will be NOT MIRRORED if the setup process is not complete. It could be TRACKING or BLOCKED if the IASP is varied off on one of the nodes.

In GUI showing active replication, the replication state of ACTIVE is shown below each node. In GUI showing active replication of an IASP, the replication state of ACTIVE is shown below each IASP. In MIRROR_INFO view showing active replication, the replication state column is shown for SYSBAS and each IASP.

Replication details

It is important to understand the Db2 Mirror processing that corresponds to the current replication state.
MAINTENANCE
Replication has been suspended for maintenance. All Db2 Mirror communication and system jobs are ended.
Start of changeREAD-ONLYEnd of change
Start of changeReplication is active and this is the secondary node which is restricted to read-only access. End of change
REPLICATING
Replication is active.
RESUMING
Replication is resuming after previously having been suspended. Resynchronizing has not yet begun.
STARTING
The initial startup of replication between the two nodes is in progress.
SUSPENDING
Replication is being suspended.
SUSPENDED
Replication has been suspended. Limited internal Db2 Mirror communication between the nodes may be available depending on the reason replication has been suspended.
SYNCHRONIZING
Resynchronization between the two nodes is in progress. There are two main phases of resynchronization. In phase one, the replication state will remain TRACKING and BLOCKED on the nodes. In phase two, the replication state will become ACTIVE.

In GUI showing active replication and GUI showing active replication of an IASP, the replication detail of Replicating is shown below the replication state of Active. In MIRROR_INFO view showing active replication, the REPLICATION_DETAIL column returns REPLICATING.

Replication information

When replication is not active, there is detailed information available to understand why Db2 Mirror replication is not occurring.

In the following figure, the replication state of node SYNC18, the primary node, is TRACKING, and the state of RESYNC18, which is the secondary node, is BLOCKED. The replication detail for both nodes is Suspending. The hover text below SYNC18 shows that the node is Suspend pending restart of limited connections between nodes.

Figure 4. GUI after a user initiated suspend
GUI after a user initiated suspend

The next figure describes a similar environment using the QSYS2.MIRROR_INFO view. The REPLICATION_DETAIL_INFO column shows reason code 212 for SYSBAS and 284 for the IASPs. The REPLICATION_DETAIL_INFO_TEXT column contains a corresponding description for each reason code.

SELECT IASP_NAME, REPLICATION_STATE,
        REPLICATION_DETAIL, REPLICATION_DETAIL_INFO,
        REPLICATION_DETAIL_INFO_TEXT,
        PRIMARY_NODE, SECONDARY_NODE
    FROM QSYS2.MIRROR_INFO;
Figure 5. MIRROR_INFO after a user initiated suspend
MIRROR_INFO after a user initiated suspend
The reason codes can be surfaced in multiple places and always have the same associated text.
  • Within the Db2 Mirror GUI, when hovering over the replication state or replication detail
  • When querying the QSYS2.MIRROR_INFO view, within the REPLICATION_DETAIL_INFO and REPLICATION_DETAIL_INFO_TEXT columns
  • Within any M9 (Db2 Mirror Replication State) Audit journal records
  • Within any CPIC901 or CPIC902 messages sent to the QSYSOPR message queue

The reason codes and their corresponding text are listed in Replication detail info.