You can use the ALTER SYSTEM ACTIVATE STANDBY statement to switch a standby tenant to the PRIMARY role after a physical restore or in a Physical Standby Database scenario.
After the ALTER SYSTEM ACTIVATE STANDBY statement is executed, the role of the original standby tenant changes from STANDBY to PRIMARY. For more information about tenant roles, see Overview.
Limitations and considerations
Before you execute this statement, make sure that the replicas of all log streams of the standby tenant are online. If any replica is not online, wait until the replica is permanently offline.
You can use this statement to change the role of only one standby tenant to PRIMARY at a time. To change the roles of multiple tenants, execute this statement repeatedly.
Required privileges
You must execute this statement as the root user of the sys tenant (namely root@sys) or as the administrator of a user tenant.
The default administrator is the
rootuser in MySQL mode.The default administrator is the
SYSuser in Oracle mode.
Syntax
ALTER SYSTEM ACTIVATE STANDBY
[TENANT tenant_name]
[VERIFY];
Parameters
| Parameter | Description |
|---|---|
| tenant_name | The name of the standby tenant to be switched to the PRIMARY role.
NoticeYou must specify the target tenant by using the |
| VERIFY | Optional. Verifies in advance whether the prerequisites for executing the ACTIVATE STANDBY statement are met.
Notice
|
Examples
Execute the following statement in the sys tenant of the cluster where the standby tenant
tenant1resides to switch the standby tenant to the PRIMARY role in a Physical Standby Database or physical backup and restore scenario:obclient [oceanbase]> ALTER SYSTEM ACTIVATE STANDBY TENANT tenant1;Execute the following statement in a standby tenant to switch it to the PRIMARY role in a Physical Standby Database or physical backup and restore scenario:
obclient [SYS]> ALTER SYSTEM ACTIVATE STANDBY;