When the primary tenant becomes unavailable, you can switch a standby tenant to the PRIMARY role to provide services.
Procedure
Log on to the database as the administrator of the standby tenant or as the
systenant of the cluster where the standby tenant resides.Execute the failover statement to switch the standby tenant to the PRIMARY role.
Execute the following statement in the
systenant 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;
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_ROLEparameter of the original standby tenant has changed toPRIMARY. If the value of theSWITCHOVER_STATUSparameter isNORMAL, the original standby tenant is switched to the PRIMARY role.For more information about the
DBA_OB_TENANTSview, see oceanbase.DBA_OB_TENANTS (MySQL Mode).
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.