Purpose
You can use this statement to losslessly switch a tenant of the PRIMARY role to a STANDBY role or the other way around.
Syntax
ALTER SYSTEM SWITCHOVER TO {STANDBY | PRIMARY}
[TENANT tenant_name]
[VERIFY];
Note
- You must specify the
TENANT tenant_nameparameter when you execute this statement in the sys tenant. - In a user tenant, you can execute this statement only for the current tenant.
Parameters
| Parameter | Description |
|---|---|
| STANDBY | Losslessly switches the primary tenant to the STANDBY role. |
| PRIMARY | Switches the standby tenant to the PRIMARY role. |
| tenant_name | The name of the primary or standby tenant. |
| VERIFY | Optional. Verifies in advance whether the prerequisites for executing the SWITCHOVER statement are met.
Notice
|
Examples
Switch the primary tenant to be a standby tenant named tenant1, and verify that the value of TENANT_ROLE has changed to STANDBY and the value of SWITCHOVER_STATUS has 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
References
For more information about the SWITCHOVER statement, see Switchover.