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 - V4.2.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    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. V4.2.0
    iconOceanBase Database
    SQL - V 4.2.0
    SQL
    KV
    • 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

    Upgrade OceanBase Database by using OBD

    Last Updated:2023-12-08 07:13:36  Updated
    share
    What is on this page
    Upgrade solutions
    Procedure
    Solution 1: Upgrade OceanBase Database online
    Solution 2: Upgrade OceanBase Database offline

    folded

    share

    This topic describes how to upgrade OceanBase Database by using OceanBase Deployer (OBD).

    Upgrade solutions

    To upgrade OceanBase Database using OBD, you have two options based on your requirements:

    • Solution 1: Online upgrade. If your server has internet access or you have configured an image repository with the RPM package for upgrading OceanBase Database, you can choose this solution for the upgrade. For more information, see Solution 1: Upgrade OceanBase Database online.

    • Solution 2: Offline upgrade. If your server does not have internet access and the configured image repository does not include an RPM package for upgrading OceanBase Database, you can run the obd mirror clone command to add the RPM package for upgrading OceanBase Database to the local image repository, or download and install the all-in-one installation package of the corresponding version, and then proceed with the upgrade. For more information, see Solution 2: Upgrade OceanBase Database offline.

    Procedure

    Solution 1: Upgrade OceanBase Database online

    1. Run the following command to enable the remote image repository:

      obd mirror enable remote
      
    2. (Optional) Run the following command to upgrade OBD to the latest version:

      obd update
      
    3. Run the following command to query the version of OceanBase Database in the remote mirror repository:

      obd mirror list oceanbase.community.stable | grep oceanbase-ce
      

      In the following sample output, the strings displayed in the rightmost column are the hash values of the corresponding versions of OceanBase Database Community Edition.

      | oceanbase-ce                      | 4.0.0.0 | 100000272022110114.el7 | x86_64 | 759074414c7b7b723013855353f62a7ba0aae0f493216ef2511825850ce77b51 |
      | oceanbase-ce                      | 4.0.0.0 | 100000282022112511.el7 | x86_64 | debb18ab3c0b3d16f145c41cd21c30686863580b721d45ddaa068e6309e03b64 |
      | oceanbase-ce                      | 4.0.0.0 | 102000032022120718.el7 | x86_64 | c63bb73384b17d74299b34fe3aceb0ae310fd319d2ccdb1acd39f31ba6673198 |
      | oceanbase-ce                      | 4.0.0.0 | 103000022023011215.el7 | x86_64 | ca467ed00a5e717f40d360ba9d08252595f4ce9de87c81e6006858fbae5755fa |
      | oceanbase-ce                      | 4.1.0.0 | 100000192023032010.el7 | x86_64 | a4a092156b5cfe6708a25813633145e0bbd75170e01e30b5c4b88fb230e10903 |
      | oceanbase-ce                      | 4.1.0.0 | 100000202023040520.el7 | x86_64 | b56ec3d6e75fd01da65abe0ebb8f8b6455d6a8563c77491ee3d19b33abc40e53 |
      | oceanbase-ce                      | 4.1.0.0 | 101000022023050809.el7 | x86_64 | fe7c4d26f18534e4116f75ddf8ecea59bfdba221e6d43c0f7ea6a24c118c3858 |
      | oceanbase-ce                      | 4.1.0.0 | 101010022023051821.el7 | x86_64 | 66882706a45d94c379dce7fd6c0b3c9c33cd780e95658d3a475029013a4b3451 |
      | oceanbase-ce                      | 4.1.0.1 | 102000042023061314.el7 | x86_64 | 126aa046ed03e191aad2481b1e4f82f43bb0017befc3b9569f4c8e215313c8ef |
      | oceanbase-ce                      | 4.1.0.2 | 103010012023082519.el7 | x86_64 | 3473fe01f6c5325a29bd325183377d102ea1f9cf1cd8bb5a0f36fac9852983cf |
      | oceanbase-ce                      | 4.2.0.0 | 100000152023080109.el7 | x86_64 | 1cbd1fde8c6d7695015265da09738478c97e0e2f908fca6745dc9cc531860e74 |
      | oceanbase-ce                      | 4.2.0.0 | 100010022023081817.el7 | x86_64 | 5cb4adf7a98754c09a82edadaf8f9485bfd6376184e4fe3109e8f607899cf8cf |
      | oceanbase-ce                      | 4.2.0.0 | 100010032023083021.el7 | x86_64 | 790596d146bd22abfbd87faf6bcacddd0d6936dafe0ff6958640bdb833256a48 |
      # Subsequent outputs omitted
      
    4. (Optional) View the primary zone configuration of tenants in the cluster.

      Note

      You must perform this step only when you upgrade OceanBase Database to V4.0.x, V4.1.x, or V4.2.0 BETA.

      Log on to the sys tenant of the database as the root user and run the following command:

      obclient [oceanbase]> select * from __all_tenant;
      

      The output is as follows:

      +----------------------------+----------------------------+-----------+-------------+-------------------+--------------+--------+----------------+---------------+---------------------------------------------+-------------------+-----------------------+--------------------+------------------+--------+---------------+----------------------------+
      | gmt_create                 | gmt_modified               | tenant_id | tenant_name | zone_list         | primary_zone | locked | collation_type | info          | locality                                    | previous_locality | default_tablegroup_id | compatibility_mode | drop_tenant_time | status | in_recyclebin | arbitration_service_status |
      +----------------------------+----------------------------+-----------+-------------+-------------------+--------------+--------+----------------+---------------+---------------------------------------------+-------------------+-----------------------+--------------------+------------------+--------+---------------+----------------------------+
      | 2023-09-08 15:04:32.205665 | 2023-09-08 15:04:32.205665 |         1 | sys         | zone1;zone2;zone3 | RANDOM       |      0 |              0 | system tenant | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 |                   |                    -1 |                  0 |               -1 | NORMAL |             0 | DISABLED                   |
      | 2023-09-08 15:13:49.119008 | 2023-09-08 15:14:09.573693 |      1001 | META$1002   | zone1;zone2;zone3 | RANDOM       |      0 |              0 |               | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 |                   |                    -1 |                  0 |               -1 | NORMAL |             0 | DISABLED                   |
      | 2023-09-08 15:13:49.126607 | 2023-09-08 15:14:09.733515 |      1002 | ocp         | zone1;zone2;zone3 | RANDOM       |      0 |              0 |               | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 |                   |                    -1 |                  0 |               -1 | NORMAL |             0 | DISABLED                   |
      +----------------------------+----------------------------+-----------+-------------+-------------------+--------------+--------+----------------+---------------+---------------------------------------------+-------------------+-----------------------+--------------------+------------------+--------+---------------+----------------------------+
      

      If the value of the primary_zone column of a tenant is RANDOM, execute the following statement to specify different priorities for the zones of the tenant:

      obclient [oceanbase]> ALTER TENANT ocp primary_zone='zone1';
      

      For more information about the ALTER TENANT statement, see ALTER TENANT.

    5. Perform a major compaction of OceanBase Database.

      Log on to the sys tenant as the root user and run the following command to perform a major compaction:

      obclient [oceanbase]> ALTER SYSTEM MAJOR FREEZE;
      

      Run the following command to check whether the major compaction is completed:

      obclient [oceanbase]> select name,value from oceanbase.__all_zone where name='frozen_version' or name='last_merged_version';
      
    6. Run the following command to upgrade OceanBase Database:

      obd cluster upgrade obtest -c oceanbase-ce -V 4.2.0.0 --usable=790596d146bd22abfbd87faf6bcacddd0d6936dafe0ff6958640bdb833256a48
      

      In this example, the cluster name is obtest and the target upgrade version is V4.2.0. You must replace the cluster name and the target version with the actual ones. For more information about the commands used in this step, see Cluster commands.

    7. Check whether the upgrade is successful.

      Log on to the sys tenant of the OceanBase database as the root user and run the following command to view the database version:

      obclient [oceanbase]> SELECT version();
      

    Solution 2: Upgrade OceanBase Database offline

    1. Configure the RPM package.

      You can run the obd mirror clone command to add the RPM package for upgrading OceanBase Database to the local image repository, or download and install the all-in-one installation package of the corresponding version.

      • Method 1: Download the RPM packages of OceanBase Database and the required dependency library from the Releases page on GitHub or OceanBase Download Center, copy the packages to the server where OBD is installed, and run the following command in the directory where the packages are located to add the packages to the local image repository:

        obd mirror clone oceanbase-ce-*.rpm
        
      • Method 2: Download the all-in-one installation package of the required version from OceanBase Download Center, copy the installation package to the server where OBD is installed, and run the following commands to decompress and install the package.

        Notice

        • You must install the all-in-one installation package with the same account that you use to install OceanBase Database, such as the admin account.

        • If you have installed the all-in-one installation package, we recommend that you use the upgrade.sh script to upgrade OBD after you download and decompress the package. To be specific, replace the ./install.sh command in the sample code with the ./upgrade.sh command.

        [admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz
        [admin@test001 ~]$ cd oceanbase-all-in-one/bin/
        [admin@test001 bin]$ ./install.sh
        [admin@test001 bin]$ source ~/.oceanbase-all-in-one/bin/env.sh
        
    2. Run the following command to disconnect from the remote image repository:

      obd mirror disable remote
      
    3. Run the following command to query the version of OceanBase Database in the local image repository:

      obd mirror list local | grep oceanbase-ce
      

      In the following sample output, the strings displayed in the rightmost column are the hash values of the corresponding versions of OceanBase Database Community Edition.

      | oceanbase-ce      | 4.1.0.1 | 102000042023061314.el7 | x86_64 | d03fafa6fa8ceb0636e4db05b5b5f6c3ac2256a3 |
      | oceanbase-ce-libs | 4.1.0.1 | 102000042023061314.el7 | x86_64 | c3f797aae1ce258ec9be77898b94e4e7a501cd0f |
      | oceanbase-ce      | 4.2.0.0 | 100010022023081817.el7 | x86_64 | bf178e82c99ca1324a3df9e1a21cbbb8f8c4d46c |
      | oceanbase-ce-libs | 4.2.0.0 | 100010022023081817.el7 | x86_64 | f77ba7e678acf0645889967391c847ca9cf684b6 |
      
    4. (Optional) View the primary zone configuration of tenants in the cluster.

      Note

      You must perform this step only when you upgrade OceanBase Database to V4.0.x, V4.1.x, or V4.2.0 BETA.

      Log on to the sys tenant of the database as the root user and run the following command:

      obclient [oceanbase]> select * from __all_tenant;
      

      The output is as follows:

      +----------------------------+----------------------------+-----------+-------------+-------------------+--------------+--------+----------------+---------------+---------------------------------------------+-------------------+-----------------------+--------------------+------------------+--------+---------------+----------------------------+
      | gmt_create                 | gmt_modified               | tenant_id | tenant_name | zone_list         | primary_zone | locked | collation_type | info          | locality                                    | previous_locality | default_tablegroup_id | compatibility_mode | drop_tenant_time | status | in_recyclebin | arbitration_service_status |
      +----------------------------+----------------------------+-----------+-------------+-------------------+--------------+--------+----------------+---------------+---------------------------------------------+-------------------+-----------------------+--------------------+------------------+--------+---------------+----------------------------+
      | 2023-09-08 15:04:32.205665 | 2023-09-08 15:04:32.205665 |         1 | sys         | zone1;zone2;zone3 | RANDOM       |      0 |              0 | system tenant | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 |                   |                    -1 |                  0 |               -1 | NORMAL |             0 | DISABLED                   |
      | 2023-09-08 15:13:49.119008 | 2023-09-08 15:14:09.573693 |      1001 | META$1002   | zone1;zone2;zone3 | RANDOM       |      0 |              0 |               | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 |                   |                    -1 |                  0 |               -1 | NORMAL |             0 | DISABLED                   |
      | 2023-09-08 15:13:49.126607 | 2023-09-08 15:14:09.733515 |      1002 | ocp         | zone1;zone2;zone3 | RANDOM       |      0 |              0 |               | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 |                   |                    -1 |                  0 |               -1 | NORMAL |             0 | DISABLED                   |
      +----------------------------+----------------------------+-----------+-------------+-------------------+--------------+--------+----------------+---------------+---------------------------------------------+-------------------+-----------------------+--------------------+------------------+--------+---------------+----------------------------+
      

      If the value of the primary_zone column of a tenant is RANDOM, execute the following statement to specify different priorities for the zones of the tenant:

      obclient [oceanbase]> ALTER TENANT ocp primary_zone='zone1';
      

      For more information about the ALTER TENANT statement, see ALTER TENANT.

    5. Perform a major compaction of OceanBase Database.

      Log on to the sys tenant as the root user and run the following command to perform a major compaction:

      obclient [oceanbase]> ALTER SYSTEM MAJOR FREEZE;
      

      Run the following command to check whether the major compaction is completed:

      obclient [oceanbase]> select name,value from oceanbase.__all_zone where name='frozen_version' or name='last_merged_version';
      
    6. Run the following command to upgrade OceanBase Database:

      obd cluster upgrade obtest -c oceanbase-ce -V 4.2.0.0 --usable=f77ba7e678acf0645889967391c847ca9cf684b6
      

      In this example, the cluster name is obtest and the target upgrade version is V4.2.0. You must replace the cluster name and the target version with the actual ones. For more information about the commands used in this step, see Cluster commands.

    7. Check whether the upgrade is successful.

      Log on to the sys tenant of the OceanBase database as the root user and run the following command to view the database version:

      obclient [oceanbase]> SELECT version();
      

    Previous topic

    Check upgrade results
    Last

    Next topic

    Failures of a minority of nodes
    Next
    What is on this page
    Upgrade solutions
    Procedure
    Solution 1: Upgrade OceanBase Database online
    Solution 2: Upgrade OceanBase Database offline