This topic describes the primary/standby switchover procedure. You can choose one of the following switchover methods based on the business needs:
- Method 1: Perform a switchover for a specified primary tenant.
- Method 2: Perform a switchover for all primary tenants in a cluster.
Method 1: Perform a switchover for a specified primary tenant
You can switch a specified primary tenant to the STANDBY role.
Prerequisites
The current primary tenant has at least one standby tenant in the Running state.
Considerations
We recommend that you set the same service name for the primary and standby tenants, and that the clusters to which the primary and standby tenants belong be associated with the same OBProxy cluster. Otherwise, automatic routing cannot be implemented after the switchover.
Procedure
Log on to the OceanBase Cloud Platform (OCP) console. In the left-side navigation pane, click Tenants. In the tenant list, find the target primary tenant and click its name to go to its basic information page.
Click the More icon in the upper-right corner and select Switchover from the menu.

In the dialog box that appears, confirm the information and click Start Switch.
If the primary tenant has multiple standby tenants, you must select a standby tenant for the switchover from the New Primary Tenants drop-down list. If the OCP multi-cluster mode is enabled, remote standby tenants managed by other OCP clusters are also displayed in the drop-down list.
If the synchronization mode of the selected standby tenant is Archiving-based and archiving is not enabled for the standby tenant, you must first configure an archiving address. The following table describes the parameters for configuring an archiving address.
Parameter Description Storage Type The type of the storage service for backup files. Valid values: - File: your local file storage system. Generally, Network File System (NFS) is used.
- OSS: Alibaba Cloud Object Storage Service (OSS), which is supported only in OceanBase Database V2.2.76 and later.
Storage Directory The directory in which the backup files are stored on the storage service. Note
The primary and standby tenants must have the read/write permissions on this directory.
Domain If you select OSS for Storage Type, enter the domain name for accessing the files stored in the OSS bucket. You can append a port number to the domain name, for example, oss.ap-shanghai.myqcloud.com:8080.User If you select OSS for Storage Type, enter the user for accessing the files stored in the OSS bucket. AccessKey Pair If you select OSS for Storage Type, enter the AccessKey pair for accessing the files stored in the OSS bucket.
Click the task ID in the dialog box to view the task progress.
Method 2: Perform a switchover for all primary tenants in a cluster
If you require standby tenants to provide services to ensure service continuity during the O&M of a cluster, you can switch all primary tenants in this cluster to the STANDBY role before the O&M.
Prerequisites
You have created primary tenants in the current cluster, and the primary tenants have available standby tenants.
You have set service names for the primary and standby tenants. Otherwise, automatic routing cannot be implemented after the switchover.
The clusters to which the primary and standby tenants belong have been associated with the same OBProxy cluster. Otherwise, automatic routing cannot be implemented after the switchover.
Procedure
Log on to the OCP console. In the left-side navigation pane, click Clusters. On the Cluster List page, go to the Overview page of the target cluster.
Click the More icon in the upper-right corner and select Tenant Switchover from the menu.

In the dialog box that appears, select the tenants for which you want to perform a switchover and click Switchover.
If a primary tenant has multiple standby tenants, you must select one of the standby tenants as the new primary tenant from the New Primary Tenants drop-down list. If the OCP multi-cluster mode is enabled, remote standby tenants managed by other OCP clusters are also displayed in the drop-down list.
Before you perform a switchover, the system will check the primary and standby tenants against the following conditions. If the check fails, you cannot perform a switchover for the selected tenants.
- The primary and standby tenants are in the Running state.
- The clusters to which the primary and standby tenants belong are in the Running state and are of the same version.
- The synchronization latency of the standby tenant does not exceed the threshold, which is 5,000 ms by default. You can choose System Management > System Parameters and change the value of
ocp.standby.tenant.delay.thresholdto adjust the threshold.
If the synchronization mode of the selected standby tenant is Archiving-based and archiving is not enabled for the standby tenant, you must first configure an archiving address. The following table describes the parameters for configuring an archiving address.
Parameter Description Storage Type The type of the storage service for backup files. Valid values: - File: your local file storage system. Generally, Network File System (NFS) is used.
- OSS: Alibaba Cloud Object Storage Service (OSS), which is supported only in OceanBase Database V2.2.76 and later.
Storage Directory The directory in which the backup files are stored on the storage service. Note
The primary and standby tenants must have the read/write permissions on this directory.
Domain If you select OSS for Storage Type, enter the domain name for accessing the files stored in the OSS bucket. You can append a port number to the domain name, for example, oss.ap-shanghai.myqcloud.com:8080.User If you select OSS for Storage Type, enter the user for accessing the files stored in the OSS bucket. AccessKey Pair If you select OSS for Storage Type, enter the AccessKey pair for accessing the files stored in the OSS bucket.
Note
This operation may cause the cluster where the new primary tenant resides to be overloaded. Proceed with caution.
Click the task ID in the dialog box to view the task progress.