OceanBase Database provides three protection modes: maximum performance, maximum protection, and maximum availability. This topic describes how to switch between any two protection modes.
Background
Before you switch the protection mode, choose an appropriate target protection mode based on your requirements for performance, data protection, and cluster availability. For more information, see Protection mode overview
Procedure
In the primary cluster, run the following command to view its protection mode.
obclient> SELECT CLUSTER_ROLE, PROTECTION_MODE FROM V$OB_CLUSTER; +----------------+--------------------------+ | CLUSTER_ROLE | PROTECTION_MODE | +----------------+--------------------------+ | PRIMARY | MAXIMUM PERFORMANCE| +----------------+--------------------------+ 1 row in setProperly configure log transmission parameters for different standby clusters based on their protection modes. For more information, see Log transfer service.
The requirements for log transfer parameters vary with the protection mode:
Maximum performance mode: none.
Maximum protection mode: You can configure only one standby cluster in
SYNCmode.Maximum availability mode: you can configure only one standby cluster in
SYNCmode. You can set theNET_TIMEOUTparameter for the standby cluster as required.
In the primary cluster, run the following command to view the log transfer parameters of all standby clusters.
obclient> SELECT CLUSTER_ID, REDO_TRANSPORT_OPTIONS FROM V$OB_STANDBY_STATUS; +-------------+-------------------------------------+ | CLUSTER_ID | REDO_TRANSPORT_OPTIONS | +-------------+-------------------------------------+ | 2 | SYNC NET_TIMEOUT = 30000000 | +-------------+-------------------------------------+ 1 row in setVerify the cluster status to ensure successful switching.
You can skip this step when you switch other modes to the maximum performance or maximum availability mode. However, when you switch other modes to the maximum protection mode, make sure that the following requirements are met:
The standby cluster in
SYNCmode is synchronized with the primary cluster.All servers in the primary cluster are active.
If the requirements are not met, the switching will fail.
To switch other modes to the maximum protection mode, perform the following operations:
Log on to the primary cluster and query the
SYNCHRONIZATION_STATUSfield in theV$OB_STANDBY_STATUSview to learn of the synchronization status of the target standby cluster.obclient> SELECT CLUSTER_ID, SYNCHRONIZATION_STATUS FROM V$OB_STANDBY_STATUS; +-------------+---------------------------------+ | CLUSTER_ID | SYNCHRONIZATION_STATUS | +-------------+---------------------------------+ | 2 | OK | +-------------+---------------------------------+ 1 row in setWhen SYNCHRONIZATION_STATUS is
OK, the standby cluster is synchronized with the primary cluster. When SYNCHRONIZATION_STATUS is another value, the standby cluster is not synchronized with the primary cluster, and you need to identify the cause. For more information, see v$ob_standby_status.Log on to the primary cluster and query the
__ALL_SERVERtable to check whether all servers are active.obclient> SELECT COUNT(*) FROM __ALL_SERVER WHERE STATUS != 'ACTIVE'; +----------+ | COUNT(*) | +----------+ | 0 | +----------+ 1 row in set
In the primary cluster, run the following command to switch its protection mode.
obclient> ALTER SYSTEM SET STANDBY CLUSTER TO MAXIMIZE {AVAILABILITY | PERFORMANCE | PROTECTION};Query the protection mode and protection level of each cluster to verify the switching result.
For more information, see Protection mode and protection level.
obclient> SELECT PROTECTION_MODE, PROTECTION_LEVEL FROM V$OB_CLUSTER; +---------------------------+----------------------------+ | PROTECTION_MODE | PROTECTION_LEVEL | +---------------------------+----------------------------+ | MAXIMUM PROTECTION | MAXIMUM PROTECTION | +---------------------------+----------------------------+ 1 row in set