Failover

2025-12-09 07:09:36  Updated

When the primary tenant becomes unavailable, you can switch a standby tenant to the PRIMARY role to provide services.

Procedure

  1. Log on to the database as the administrator of the standby tenant or as the sys tenant of the cluster where the standby tenant resides.

  2. Execute the failover statement to switch the standby tenant to the PRIMARY role.

    • Execute the following statement in the sys tenant of the cluster where the standby tenant resides to switch the standby tenant to the PRIMARY role:

      ALTER SYSTEM ACTIVATE STANDBY TENANT = tenant_name;
      
    • Execute the following statement in the standby tenant to switch it to the PRIMARY role:

      ALTER SYSTEM ACTIVATE STANDBY;
      
  3. Check whether the standby tenant is switched to the PRIMARY role.

    Sample statement:

    SELECT TENANT_ID, TENANT_NAME,TENANT_TYPE,TENANT_ROLE,SWITCHOVER_STATUS
    FROM oceanbase.DBA_OB_TENANTS
    WHERE TENANT_NAME='oracle_standby';
    

    The query result shows that the value of the TENANT_ROLE parameter of the original standby tenant has changed to PRIMARY. If the value of the SWITCHOVER_STATUS parameter is NORMAL, the original standby tenant is switched to the PRIMARY role.

Considerations

The failover operation recovers the synchronized data of all log streams to the consistency checkpoint. This ensures that the data of all log streams before the checkpoint is complete. Therefore, after a failover operation is performed, the following rules apply:

  • The original primary tenant cannot be a standby tenant of the new primary tenant.

  • If the logs of a third-party standby tenant are synchronized to a checkpoint that exceeds the consistency checkpoint, you cannot use the third-party standby tenant as a standby tenant of the new primary tenant. For ease of management, we recommend that you do not use a third-party standby tenant as a standby tenant of the new primary tenant.

Contact Us