Purpose
This statement is used to switch the primary and standby roles of a tenant. It allows you to switch a primary tenant to a standby tenant and vice versa.
Syntax
ALTER SYSTEM SWITCHOVER TO {STANDBY | PRIMARY}
[TENANT tenant_name]
[VERIFY];
Note
- When executed by the system tenant, the
TENANT tenant_nameparameter must be specified. - Regular tenants can only execute this command for themselves.
Parameters
| Parameter | Description |
|---|---|
| STANDBY | Switches the primary tenant to a standby tenant without data loss. |
| PRIMARY | Switches the standby tenant to a primary tenant. |
| tenant_name | Specifies the name of the primary or standby tenant. |
| VERIFY | Optional. When specified, it performs a pre-check to verify whether the prerequisites for executing the SWITCHOVER command are met.
Notice
|
Examples
Execute the SWITCHOVER command to switch the primary tenant to a standby tenant named tenant1 and verify that the TENANT_ROLE has changed to STANDBY and the 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 command, see Switchover.
