Purpose
You can use this statement to switch primary and standby tenant roles: losslessly switch a primary tenant to a standby tenant, or switch a standby tenant to a primary tenant.
Syntax
ALTER SYSTEM SWITCHOVER TO {STANDBY | PRIMARY}
[TENANT tenant_name]
[VERIFY [NOWAIT]];
Note
- You must specify the
TENANT tenant_nameparameter when you execute this statement in the system tenant (`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
|
| NOWAIT | Optional. Specifies not to wait during verification and to immediately return an error if any prerequisite is not met.
NoteFor V4.4.2, this parameter is supported starting from V4.4.2 BP2. |
Examples
Perform a primary-to-standby switchover on primary tenant
tenant1, and verify thatTENANT_ROLEhas changed toSTANDBYandSWITCHOVER_STATUShas changed toNORMAL.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 setBefore performing a primary-to-standby switchover on the primary tenant, run a pre-check to confirm whether the prerequisites for executing the
SWITCHOVERstatement are met, and return an error immediately if any prerequisite is not met.obclient> ALTER SYSTEM SWITCHOVER TO STANDBY VERIFY NOWAIT;
References
For more information about the SWITCHOVER statement, see Switchover.
