OceanBase logo

OceanBase

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

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

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

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.5

    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.5
    iconOceanBase Database
    SQL - V 4.2.5
    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

    Clear an OceanBase cluster

    Last Updated:2026-04-09 09:38:52  Updated
    share
    What is on this page
    Considerations
    Scenario 1: Clear an OceanBase cluster deployed by using the CLI
    Step 1: Stop and uninstall services
    Step 2: Clean up the database files
    Scenario 2: Clear an OceanBase cluster deployed by using obd
    Scenario 3: Clear an OceanBase cluster deployed by using systemd
    References

    folded

    share

    If you have deployed an OceanBase cluster on your servers and you want to deploy a new OceanBase cluster, you must clear the old cluster before you deploy the new one.

    This topic describes three scenarios. You can refer to the steps for an appropriate scenario based on the actual situation.

    Considerations

    Before you clear the environment of an OceanBase cluster, we recommend that you back up your data. This ensures the integrity and security of your data and provides you a data copy for restore or migration in the future.

    For more information about how to back up data for an OceanBase cluster, see Preparations.

    Scenario 1: Clear an OceanBase cluster deployed by using the CLI

    If your cluster is manually deployed by using the CLI, perform the following steps to clear the cluster:

    Step 1: Stop and uninstall services

    Stop the old observer processes and ensure that they are not running. Then, uninstall the related database software. The procedure is as follows:

    Notice

    OceanBase Database becomes unavailable after the observer processes are stopped. Therefore, before you perform the following steps, make sure that the old OceanBase cluster is no longer in use and the data is backed up. Proceed with caution to avoid unexpected data loss or system unavailability.

    1. Run the following command to check whether the observer process exists:

      ps -ef|grep observer
      
    2. (Optional) Stop the observer process.

      If the observer process exists on your server, run the following command to stop the observer process:

      kill -9 `pidof observer`
      
    3. Run the following command to view the name of the installed RPM package of OceanBase Database:

      rpm -qa|grep oceanbase
      
    4. Run the following command to uninstall the RPM package of OceanBase Database:

      sudo rpm -e $rpm_name
      

      Here, $rpm_name is the name of the RPM package to be uninstalled.

      You can run the following command to check whether the RPM package is completely uninstalled.

      rpm -ql $rpm_name
      
    5. Repeat steps 1 to 4 until services on all OBServer nodes are stopped and uninstalled.

    Step 2: Clean up the database files

    Remove the obsolete database files, including data files, log files, and other temporary files.

    Notice

    The following operations are irreversible. In other words, the deleted files and directories cannot be recovered. Therefore, before you run the following commands, make sure that the data in the directories is no longer needed.

    1. Run the following command to remove files on the runtime log disk of the observer process:

      sudo rm -rf /home/admin/oceanbase/*
      
    2. Run the following command to remove files on the log disk of the observer process:

      sudo rm -rf /data/log1/*
      
    3. Run the following command to remove files on the data disk of the observer process:

      sudo rm -rf /data/1/*
      
    4. Repeat steps 1 to 3 until all database files are removed from all OBServer nodes.

    Scenario 2: Clear an OceanBase cluster deployed by using obd

    If your cluster is deployed by using OceanBase Deployer (obd), perform the following steps to clear the cluster:

    1. Query the cluster status.

      obd cluster list
      

      The output is as follows. For more information, see the obd cluster list section in Cluster commands.

      +--------------------------------------------------------+
      |                     Cluster List                       |
      +------+-------------------------------+-----------------+
      | Name | Configuration Path            | Status (Cached) |
      +------+-------------------------------+-----------------+
      | test | /home/admin/.obd/cluster/odp  | running         |
      | demo | /home/admin/.obd/cluster/demo | running         |
      +------+-------------------------------+-----------------+
      
    2. Check whether a standby tenant exists.

      We will use the test cluster as an example. Make sure to replace it with the actual cluster name when you run the following command.

      obd cluster tenant show test -g
      

      The output is as follows, indicating that no standby tenant exists and the cluster contains only the sys tenant. If a tenant in the cluster has a standby tenant, you can see the Deploy primary and standby tenants by using obd topic for the output and field description.

      +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      |                                                                                     tenant base info                                                                                    |
      +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+
      | tenant_name | tenant_type | compatibility_mode | primary_zone | max_cpu | min_cpu | memory_size | max_iops            | min_iops            | log_disk_size | iops_weight | tenant_role |
      +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+
      | sys         | SYS         | MYSQL              | RANDOM       | 3.0     | 3.0     | 1024M       | 9223372036854775807 | 9223372036854775807 | 2048M         | 3           | PRIMARY     |
      +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+
      
    3. (Optional) Decouple the standby tenant from the primary tenant.

      If a tenant in the cluster has a standby tenant, attempting to destroy the cluster will return an error. To proceed, either decouple the standby tenant from the primary tenant first or forcibly destroy the cluster. After the cluster is forcibly destroyed, the standby tenant will be unavailable. You can determine whether to perform this step based on the actual situation.

      For more information, see Switch the roles of tenants and decouple a standby tenant from the primary tenant.

    4. Destroy the cluster.

      Notice

      The destroy command is irreversible. Data files will be cleared while the observer processes are stopped. Therefore, before you run the following commands, make sure that the cluster is no longer needed and the data has been backed up.

      We will use the test cluster as an example. Make sure to replace it with the actual cluster name when you run the following command.

      obd cluster destroy test -f [--igs]
      

      -f: If a running process is detected in the working directory, the process is forcibly stopped and the cluster is destroyed.

      --igs: If a tenant in the cluster has a standby cluster in another cluster, the obd cluster destroy command is forcibly executed.

    Scenario 3: Clear an OceanBase cluster deployed by using systemd

    If your cluster is deployed by using systemd, perform the following steps to clear the cluster:

    1. Stop OceanBase Database.

      [admin@test001 ~]$ sudo systemctl stop oceanbase
      
    2. Uninstall OceanBase Database.

      1. Delete the package of OceanBase Database.

        If you have installed OceanBase Database online, run the following command to delete the package:

        [admin@test001 ~]$ sudo yum erase package 
        

        You must replace package with the actual name of the package to be deleted. To view the package name, run the yum list | grep oceanbase command.

        If you have installed OceanBase Database offline, run the following command to delete the package:

        [admin@test001 ~]$ sudo rpm -e package
        

        You must replace package with the actual name of the package to be deleted. To view the package name, run the rpm -qa | grep oceanbase command.

      2. (Optional) Delete the data of OceanBase Database.

        Note

        After the package is deleted, OceanBase Database is uninstalled but its data is retained in your environment. If you deploy OceanBase Database again later, you can still view and operate the retained data. After you perform this step, the data of OceanBase Database is completely deleted. Therefore, before you run the following commands, make sure that the data in the directories is no longer needed.

        Delete the installation directory of OceanBase Database.

        [admin@test001 ~]$ sudo rm -rf /home/admin/oceanbase 
        

        Delete the data directory of OceanBase Database.

        [admin@test001 ~]$ sudo rm -rf /var/lib/oceanbase 
        

    References

    • If your OceanBase cluster is managed by using OceanBase Cloud Platform (OCP), you can delete the cluster as prompted. For more information, see Delete a cluster.

    • If your OceanBase cluster is deployed in a Kubernetes environment, you can manage your cluster by using ob-operator. For more information about how to delete a cluster in this case, see Delete a cluster.

    Previous topic

    Deploy an OceanBase cluster in a Kubernetes environment
    Last

    Next topic

    Overview
    Next
    What is on this page
    Considerations
    Scenario 1: Clear an OceanBase cluster deployed by using the CLI
    Step 1: Stop and uninstall services
    Step 2: Clean up the database files
    Scenario 2: Clear an OceanBase cluster deployed by using obd
    Scenario 3: Clear an OceanBase cluster deployed by using systemd
    References