OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V3.2.4Enterprise Edition

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V3.2.4
    iconOceanBase Database
    SQL - V 3.2.4Enterprise Edition
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    CONVERT

    Last Updated:2023-10-24 09:23:03  Updated
    Share
    What is on this page
    Purpose
    Syntax
    Examples

    folded

    Share

    Purpose

    You can use this statement to convert a primary cluster into a standby cluster.

    When a failover occurs, if there are two clusters, you can use CONVERT to covert the original primary cluster to a standby cluster. The purpose is to establish a primary/standby relationship between the original and new primary clusters.

    Notice

    If no other clusters are available, the current cluster cannot be converted to a standby cluster.

    Syntax

    ALTER SYSTEM CONVERT TO PHYSICAL STANDBY;
    

    Examples

    • Connect to the original primary cluster after a lossless failover.

      1. Restore the original primary cluster.

        Before the original primary cluster is restored, all servers in the original primary cluster must be disabled. This can ensure that data of the original primary cluster is consistent with that of the new primary cluster.

        All servers in the original primary cluster must start by using the -m disabled_cluster option during the restore of the original primary cluster. After the original primary cluster is started, it automatically enters the DISABLED status. The original primary cluster in the DISABLED status does not receive data writes or generate new logs. This ensures that the original primary cluster is in the same state as the new primary cluster. If all servers in the original primary cluster do not start by using the -m disabled_cluster option, the original primary cluster will generate new logs, causing a connection failure or data checksum error.

        Specify the -m disabled_cluster parameter on all servers of the original primary cluster to start the OBServer node.

        bin/observer -m disabled_cluster
        

        After the original primary cluster is restored, it is in the DISABLED state but its role is PRIMARY.

        obclient> SELECT CLUSTER_ID, CLUSTER_ROLE, CLUSTER_STATUS FROM V$OB_CLUSTER;
        +------------+--------------+----------------+
        | CLUSTER_ID | CLUSTER_ROLE | CLUSTER_STATUS |
        +------------+--------------+----------------+
        | 1          | PRIMARY      | DISABLED       |
        +------------+--------------+----------------+
        1 row in set
        
      2. Switch the original primary cluster to the standby role.

        Execute the following statement on the original primary cluster to switch it to the standby role:

        obclient> ALTER SYSTEM CONVERT TO PHYSICAL STANDBY;
        

        Execute the following statement to verify the role of the original primary cluster:

        obclient> SELECT CLUSTER_ID, CLUSTER_ROLE, CLUSTER_STATUS FROM V$OB_CLUSTER;
        +------------+------------------+----------------+
        | CLUSTER_ID | CLUSTER_ROLE     | CLUSTER_STATUS |
        +------------+------------------+----------------+
        | 1          | PHYSICAL STANDBY | DISABLED       |
        +------------+------------------+----------------+
        1 row in set
        
      3. In the new primary cluster, enable synchronization to the original primary cluster, which is now a standby cluster.

        1. Log on to the new primary cluster and execute the following statement to enable synchronization to standby clusters:

          obclient> ALTER SYSTEM ENABLE CLUSTER SYNCHRONIZATION 'obcluster' CLUSTER_ID=1;
          
        2. Verify that synchronization is enabled.

          obclient> SELECT CLUSTER_ID, CLUSTER_ROLE, CLUSTER_STATUS FROM V$OB_STANDBY_STATUS;
          +------------+------------------+----------------+
          | CLUSTER_ID | CLUSTER_ROLE     | CLUSTER_STATUS |
          +------------+------------------+----------------+
          | 1          | PHYSICAL STANDBY | VALID          |
          +------------+------------------+----------------+
          1 row in set
          
    • Connect to the original primary cluster after a lossy failover.

      1. Delete the original primary cluster or other standby clusters from the new primary cluster, and clear the data of the original primary cluster or other standby clusters.

        1. In the new primary cluster, execute the following statement to query information about other clusters.

          obclient> SELECT CLUSTER_ID, CLUSTER_ROLE, CLUSTER_STATUS FROM V$OB_STANDBY_STATUS;
          +------------+------------------+----------------+
          | CLUSTER_ID | CLUSTER_ROLE     | CLUSTER_STATUS |
          +------------+------------------+----------------+
          |          1 | PHYSICAL STANDBY |       DISABLED |
          +------------+------------------+----------------+
          1 row in set
          
        2. In the new primary cluster, execute the following statement to delete information about other clusters:

          obclient> ALTER SYSTEM REMOVE CLUSTER obcluster CLUSTER_ID = 1;
          Query OK, 0 rows affected
          
        3. Manually clear the processes and data of the other clusters.

      2. Create standby clusters on the servers hosting the other clusters and rebuild the primary/standby relationship.

        Notice

        After a lossy failover, the system automatically initiates a major compaction. You need to wait for the major compaction to complete and then create a standby cluster.
        You can execute an SQL statement to add a standby cluster. When you add a standby cluster, ensure that the ````cluster ID assigned to the standby cluster is unique.

      3. After the new standby cluster is synchronized in real time, switch the primary and standby roles.

    Previous topic

    CLUSTER
    Last

    Next topic

    DELETE BACKUPSET
    Next
    What is on this page
    Purpose
    Syntax
    Examples