Purpose
This statement is used for tenant primary/standby role switchover commands, enabling a lossless switchover from the primary tenant to the standby tenant, and from the standby tenant back to the primary tenant.
Syntax
ALTER SYSTEM SWITCHOVER TO {STANDBY | PRIMARY}
[TENANT tenant_name]
[VERIFY];
Note
- The
TENANT tenant_nameparameter is required when the system tenant executes this command. - A user tenant can only execute this command for itself.
Syntax
Field |
Note |
|---|---|
| STANDBY | Perform a lossless switchover from the primary tenant to the standby tenant. |
| PRIMARY | Switch the standby tenant to the primary tenant. |
| tenant_name | Specify the primary/standby tenant name. |
| VERIFY | Optional. When this parameter is used, it performs a pre-check to confirm the execution of SWITCHOVER Whether the prerequisites for the command are met.
Notice
|
Examples
Execute the primary-to-standby switchover command for the primary tenant to change it to a standby tenant named tenant1, and verify that the primary tenant has been switched to a standby tenant, with TENANT_ROLE changed to STANDBY and SWITCHOVER_STATUS changed to NORMAL.
obclient> ALTER SYSTEM SWITCHOVER TO STANDBY TENANT tenant1;
Query OK, 0 rows affected
obclient> SELECT TENANT_NAME,TENANT_TYPE,TENANT_ROLE,SWITCHOVER_STATUS FROM DBA_OB_TENANTS
WHERE TENANT_NAME='tenant1';
+---------------------+-------------+-------------+-------------------+
| TENANT_NAME | TENANT_TYPE | TENANT_ROLE | SWITCHOVER_STATUS |
+---------------------+-------------+-------------+-------------------+
| t1 | USER | STANDBY | NORMAL |
+---------------------+-------------+-------------+-------------------+
1 row in set