Preparations for a switchover

2023-08-18 09:26:34  Updated

This topic describes the preparations before you switch the primary and standby roles, including the steps of obtaining cluster information and selecting a standby cluster to switch it to the primary role.

Obtain cluster information

Query the V$OB_CLUSTER view to obtain the role, status, protection mode, and protection level of each cluster.

Example:

  1. Run the following command to obtain the role and status of the current cluster:

    obclient> SELECT CLUSTER_ID, CLUSTER_NAME, CLUSTER_ROLE, CLUSTER_STATUS FROM V$OB_CLUSTER;
    +------------+--------------+--------------+----------------+
    | CLUSTER_ID | CLUSTER_NAME | CLUSTER_ROLE | CLUSTER_STATUS |
    +------------+--------------+--------------+----------------+
    |          1 | obcluster    | PRIMARY      | VALID          |
    +------------+--------------+--------------+----------------+
    1 row in set
    

    In the example:

    • CLUSTER_ID indicates the ID of the current cluster. The primary and standby clusters have different cluster IDs.

    • CLUSTER_NAME indicates the name of the current cluster. The primary and standby clusters have the same cluster name.

    • CLUSTER_ROLE indicates the role of the current cluster. PRIMARY indicates a primary cluster, and PHYSICAL STANDBY indicates a standby cluster.

    • CLUSTER_STATUS indicates the status of the current cluster. VALID indicates that the cluster is normal. DISABLED indicates that synchronization is disabled. Only the primary and standby clusters in the VALID state support role switchover.

    After you identify the primary cluster, you can query the V$OB_STANDBY_STATUS view of the primary cluster to obtain the list of all standby clusters and their status.

    In this example, two standby clusters whose IDs are respectively 2 and 3 are in the VALID state.

    obclient> SELECT CLUSTER_ID, CLUSTER_NAME, CLUSTER_ROLE, CLUSTER_STATUS FROM V$OB_STANDBY_STATUS;
    +------------+--------------+------------------+----------------+
    | CLUSTER_ID | CLUSTER_NAME | CLUSTER_ROLE     | CLUSTER_STATUS |
    +------------+--------------+------------------+----------------+
    |          2 | obcluster    | PHYSICAL STANDBY | VALID          |
    |          3 | obcluster    | PHYSICAL STANDBY | VALID          |
    +------------+--------------+------------------+----------------+
    2 rows in set
    
  2. Run the following command to obtain the protection mode and protection level of the current cluster:

    obclient> SELECT PROTECTION_MODE, PROTECTION_LEVEL FROM V$OB_CLUSTER;
    +--------------------+--------------------+
    | PROTECTION_MODE    | PROTECTION_LEVEL   |
    +--------------------+--------------------+
    | MAXIMUM PROTECTION | MAXIMUM PROTECTION |
    +--------------------+--------------------+
    1 row in set
    

    In the example:

Select a standby cluster to be switched to the primary role

When multiple standby clusters exist, select an appropriate one as the target cluster to be switched to the primary role by considering the following aspects:

  • Region

  • Hardware configurations, including the CPUs and I/O bandwidth

  • Synchronization progress

    In maximum performance mode, a longer latency of the standby cluster to the primary cluster means longer switch time and more severe data loss after a failover.

  • Protection mode and protection level

    In maximum protection or maximum availability mode, only a standby cluster in SYNC mode can be switched to the primary role. During a failover, an appropriate failover command must be selected based on the protection mode and the protection level.

To view information about clusters, perform the following operations:

  1. Query the CURRENT_SCN field in the V$OB_CLUSTER view of each cluster to obtain the synchronization progress of the cluster.

    CURRENT_SCN is a UNIX timestamp indicating the current synchronization progress. It is an integer value in microseconds.

    For example, you can log on to standby cluster 2 and run the following SQL command to query its synchronization progress:

    obclient> SELECT CURRENT_SCN, USEC_TO_TIME(CURRENT_SCN) AS SYNC_TS FROM V$OB_CLUSTER;
    +------------------+----------------------------+
    | CURRENT_SCN      | SYNC_TS                    |
    +------------------+----------------------------+
    | 1596354672506590 | 2020-08-02 15:51:12.506590 |
    +------------------+----------------------------+
    1 row in set
    

    A greater value of CURRENT_SCN indicates a lower synchronization latency of the standby cluster. A standby cluster with a low synchronization latency can be selected as the target standby cluster to be switched to the primary role. You can subtract the value of CURRENT_SCN of the standby cluster from the value of CURRENT_SCN of the primary cluster to obtain the synchronization latency of the standby cluster.

  2. Query the V$OB_STANDBY_STATUS view of the primary cluster to view the configurations and protection level of each standby cluster.

    obclient> SELECT CLUSTER_ID, PROTECTION_LEVEL, REDO_TRANSPORT_OPTIONS FROM V$OB_STANDBY_STATUS;
    +------------+---------------------+------------------------------+
    | CLUSTER_ID |         PROTECTION_LEVEL    |   REDO_TRANSPORT_OPTIONS       |
    +------------+---------------------+------------------------------+
    |                  2 |    MAXIMUM PROTECTION  |  SYNC NET_TIMEOUT = 30000000  |
    |                  3 | MAXIMUM PERFORMANCE | ASYNC NET_TIMEOUT = 30000000 |
    +------------+---------------------+------------------------------+
    2 rows in set
    

    In the example:

    • REDO_TRANSPORT_OPTIONS indicates the log transfer configurations of each standby cluster. SYNC indicates a standby cluster in SYNC mode. ASYNC indicates a standby cluster in ASYNC mode.

    • PROTECTION_LEVEL indicates the protection level of each standby cluster. It is equivalent to the PROTECTION_LEVEL field in the V$OB_CLUSTER view.

Contact Us