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

    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.1
    iconOceanBase Database
    SQL - V 4.2.1
    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

    PURGE

    Last Updated:2023-12-25 08:49:41  Updated
    share
    What is on this page
    Purpose
    Syntax
    Parameters
    Examples

    folded

    share

    Purpose

    You can use this statement to purge database objects, such as tenants, databases, tables, and indexes, from the recycle bin.

    Syntax

     PURGE {TENANT | DATABASE | TABLE | INDEX} object_name;
    
    object_name:
        tenant_name
      | database_name
      | table_name
      | index_name
    

    Parameters

    Parameter Description
    tenant_name The name of the tenant to be purged. You can use the original name of the tenant before it is dropped to the recycle bin or the name of the tenant in the recycle bin. The name of the tenant in the recycle bin is unique and can identify the tenant. The original name of the tenant may be repeated. If you use the original name of the tenant, the tenant entered the recycle bin at the earliest time is purged.
    database_name The name of the database to be purged from the recycle bin, which is the database name in the recycle bin. You cannot set this parameter to the original name of the database.
    table_name The name of the table to be purged from the recycle bin, which is the table name in the recycle bin. You cannot set this parameter to the original name of the table.
    index_name The name of the index to be purged from the recycle bin, which is the index name in the recycle bin. You cannot set this parameter to the original name of the index.

    Examples

    • Purge the mysql tenant from the recycle bin.

      obclient> SHOW RECYCLEBIN;
      +--------------------------------+---------------+--------+----------------------------+
      | OBJECT_NAME                    | ORIGINAL_NAME | TYPE   | CREATETIME                 |
      +--------------------------------+---------------+--------+----------------------------+
      | __recycle_$_1_1599722585571328 | mysql         | TENANT | 2020-09-10 15:36:54.712101 |
      +--------------------------------+---------------+--------+----------------------------+
      1 row in set
      
      obclient> PURGE TENANT mysql;
      Query OK, 0 rows affected
      
      obclient> SHOW RECYCLEBIN;
      Empty set
      
    • Purge the __recycle_$_1_1597384386029184 database from the recycle bin.

      obclient> CREATE DATABASE db1;
      Query OK, 1 row affected
      
      obclient> DROP DATABASE db1;
      Query OK, 0 rows affected
      
      obclient> SHOW RECYCLEBIN;
      +--------------------------------+---------------+----------+----------------------------+
      | OBJECT_NAME                    | ORIGINAL_NAME | TYPE     | CREATETIME                 |
      +--------------------------------+---------------+----------+----------------------------+
      | __recycle_$_1_1597384386029184 | db1           | DATABASE | 2020-08-14 13:53:06.029367 |
      +--------------------------------+---------------+----------+----------------------------+
      1 row in set
      
      obclient> PURGE DATABASE __recycle_$_1_1597384386029184;
      Query OK, 0 rows affected
      
      obclient> SHOW RECYCLEBIN;
      Empty set
      
    • Purge the __recycle_$_1_1099511628776_1099511677778 table from the recycle bin.

      obclient> CREATE TABLE test(c1 INT);
      Query OK, 0 rows affected
      
      obclient> DROP TABLE test;
      Query OK, 0 rows affected
      
      obclient> SHOW RECYCLEBIN;
      +-------------------------------------------+---------------+-------+----------------------------+
      | OBJECT_NAME                               | ORIGINAL_NAME | TYPE  | CREATETIME                 |
      +-------------------------------------------+---------------+-------+----------------------------+
      | __recycle_$_1_1099511628776_1099511677778 | test          | TABLE | 2017-10-20 17:40:22.304025 |
      +-------------------------------------------+---------------+-------+----------------------------+
      1 row in set
      
      obclient> PURGE TABLE __recycle_$_1_1099511628776_1099511677778;
      Query OK, 0 rows affected
      
      obclient> SHOW RECYCLEBIN;
      Empty set
      
    • Purge the __recycle_$_1_1597387726700872 index from the recycle bin.

      obclient> CREATE TABLE t1(c1 INT);
      Query OK, 0 rows affected
      
      obclient> CREATE INDEX idx ON t1(c1);
      Query OK, 0 rows affected
      
      obclient> DROP TABLE t1;
      Query OK, 0 rows affected
      
      obclient> SHOW RECYCLEBIN;
      +--------------------------------+----------------------------+-------+----------------------------+
      | OBJECT_NAME                    | ORIGINAL_NAME              | TYPE  | CREATETIME                 |
      +--------------------------------+----------------------------+-------+----------------------------+
      | __recycle_$_1_1597387726700872 | __idx_1101710651081557_idx | INDEX | 2020-08-14 14:48:46.699145 |
      | __recycle_$_1_1597387726712976 | t1                         | TABLE | 2020-08-14 14:48:46.712643 |
      +--------------------------------+----------------------------+-------+----------------------------+
      2 rows in set
      
      obclient> PURGE INDEX __recycle_$_1_1597387726700872;
      Query OK, 0 rows affected
      
      obclient> SHOW RECYCLEBIN;
      +--------------------------------+----------------------------+-------+----------------------------+
      | OBJECT_NAME                    | ORIGINAL_NAME              | TYPE  | CREATETIME                 |
      +--------------------------------+----------------------------+-------+----------------------------+
      | __recycle_$_1_1597387726700872 | __idx_1101710651081557_idx | INDEX | 2020-08-14 14:48:46.699145 |
      +--------------------------------+----------------------------+-------+----------------------------+
      1 rows in set
      

    Previous topic

    PREPARE
    Last

    Next topic

    PURGE RECYCLEBIN
    Next
    What is on this page
    Purpose
    Syntax
    Parameters
    Examples