You can use the ALTER SYSTEM ACTIVATE STANDBY statement to activate a standby tenant as the primary tenant after physical restore completes, or when preparing for a standby-to-primary switch 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 of tenant roles.
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 system tenant (sys tenant) (namely, root@sys) or as the administrator of a user tenant.
In MySQL-compatible mode, the default administrator is the
rootuser.In Oracle-compatible mode, the default administrator is the
SYSuser.
Syntax
ALTER SYSTEM ACTIVATE STANDBY
[TENANT tenant_name]
[VERIFY [NOWAIT]];
Parameters
Parameter |
Description |
|---|---|
| tenant_name | The name of the standby tenant to be activated as the primary tenant.
NoticeYou must specify the target tenant by using the |
| VERIFY | Optional. This parameter specifies to verify in advance whether the prerequisites for executing the ACTIVATE STANDBY 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
In a physical standby database scenario, the system tenant (
systenant) of the cluster where the standby tenant resides activates standby tenanttenant1as the primary tenant. Alternatively, in a physical backup and restore scenario, the system tenant activates the newly restored standby tenanttenant1as the primary tenant to provide services.obclient [oceanbase]> ALTER SYSTEM ACTIVATE STANDBY TENANT tenant1;In a physical standby database scenario, a standby tenant activates itself as the primary tenant. Alternatively, in a physical backup and restore scenario, a standby tenant activates itself as the primary tenant to provide services.
obclient [SYS]> ALTER SYSTEM ACTIVATE STANDBY;Before performing failover to switch a standby tenant to primary, run a pre-check to confirm whether the prerequisites for executing the
ACTIVATE STANDBYstatement are met, and return an error immediately if any prerequisite is not met.obclient> ALTER SYSTEM ACTIVATE STANDBY VERIFY NOWAIT;
