Skip to main content
Version: V1.4.0

View instance synchronization status

When creating a standby or changing roles, use V$OB_SERVER_STAT to view the active role and log SCNs.

View public status​

Connect to the target instance and execute:

SELECT ROLE, SYNC_SCN, READABLE_SCN
FROM oceanbase.V$OB_SERVER_STAT;

The following table describes the main fields.

FieldDescription
ROLEThe active role. Valid values are PRIMARY and STANDBY.
SYNC_SCNThe log SCN synchronized by the current instance. On the primary, this is the current decided log SCN.
READABLE_SCNThe highest SCN at which the current instance can provide a consistent read.

On a standby, READABLE_SCN must not be greater than SYNC_SCN. If both SCNs keep advancing and approach the primary's SCN, log synchronization and replay are operating normally.

Diagnose a role change​

During a role change, execute the following query when you need to inspect the pending role, switchover status, and upstream endpoint:

SELECT ROLE, PENDING_ROLE, SWITCHOVER_STATUS,
LOG_RESTORE_SOURCE, SYNC_SCN, READABLE_SCN
FROM oceanbase.__all_virtual_server_stat;
FieldDescription
PENDING_ROLEThe target role that has been persisted but is not yet active. This value is empty when no role change is pending.
SWITCHOVER_STATUSNORMAL means that no switchover is incomplete. PREPARING means that the switchover intent has been persisted and follow-up steps are pending.
LOG_RESTORE_SOURCEThe standby's upstream endpoint in IP:RPC_PORT format. This value is normally empty on a primary.

After ALTER SYSTEM SWITCHOVER TO STANDBY is executed, the original primary is expected to temporarily report:

ROLE=PRIMARY
PENDING_ROLE=STANDBY
SWITCHOVER_STATUS=PREPARING

This state means that writes have been blocked and the target role has been persisted. It does not mean that the running process is already a standby. The STANDBY role becomes active and SWITCHOVER_STATUS returns to NORMAL only after restart.

note

__all_virtual_server_stat is an internal diagnostic interface whose fields may change across versions. Applications must use the public V$OB_SERVER_STAT view.