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.3.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.3.5
    iconOceanBase Database
    SQL - V 4.3.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

    Enable or disable the recycle bin

    Last Updated:2026-04-09 02:53:55  Updated
    share
    What is on this page
    Background information
    Procedure
    References

    folded

    share

    In OceanBase Database, you can set the recyclebin parameter to enable or disable the recycle bin. By default, the recycle bin is disabled. If the recycle bin is enabled, when you perform the DROP operation on a database object or tenant, the object or tenant is moved to the recycle bin.

    Background information

    The system variables of OceanBase Database can be categorized into global variables and session-level variables. You can enable or disable the recycle bin in an appropriate way based on your business needs.

    • A global variable is used to implement a global modification. Different users of the same database tenant share the settings of global variables. Modification to global variables remains effective after you exit the session. In addition, modification to a global variable does not take effect on the currently open session and takes effect only after a new session is established.

    • A session-level variable is used to implement a session modification. When a client is connected to the database, the database copies global variables to automatically generate session-level variables. Modifications made to session-level variables apply to the current session only.

    In OceanBase Database, you can manage different objects in the recycle bins of the sys tenant and user tenants.

    • After the recycle bin is enabled in the sys tenant, you can manage databases, tables, indexes, and tenants in the recycle bin.

    • After the recycle bin is enabled in a MySQL user tenant, you can manage databases, tables, and indexes in the recycle bin.

    • After the recycle bin is enabled in an Oracle user tenant, you can manage tables and indexes in the recycle bin.

    Procedure

    1. Log in to the database as an administrator of the sys tenant or a user tenant.

      Note

      The administrator user of a MySQL user tenant is root and that of an Oracle user tenant is SYS.

      Note that you must specify the corresponding fields in the following sample code based on your actual database configurations.

      obclient -h10.xx.xx.xx -P2883 -uroot@sys -p***** -A
      

      For more information about how to connect to a database, see Overview (MySQL mode) or Overview (Oracle mode).

    2. Execute the following statement to view the status of the recycle bin:

      obclient [(none)]> SHOW VARIABLES LIKE 'recyclebin';
      +---------------+-------+
      | Variable_name | Value |
      +---------------+-------+
      | recyclebin    | ON    |
      +---------------+-------+
      1 row in set
      
    3. Choose an appropriate method to enable or disable the recycle bin based on your business needs.

      The recyclebin variable is Boolean and can be set to one of the following values:

      • on, 1, or true: specifies to enable the recycle bin.

      • off, 0, or false: specifies to disable the recycle bin.

      • Enable or disable the recycle bin for the entire tenant

        The global setting applies to the entire tenant. It does not take effect on the current session and takes effect only on sessions established upon re-login.

        The syntax is as follows:

        obclient [(none)]> SET GLOBAL recyclebin = on;
        
        obclient [(none)]> SET GLOBAL recyclebin = off;
        

        or

        obclient [(none)]> SET GLOBAL recyclebin = 1;
        
        obclient [(none)]> SET GLOBAL recyclebin = 0;
        

        or

        obclient [(none)]> SET GLOBAL recyclebin = true;
        
        obclient [(none)]> SET GLOBAL recyclebin = false;
        
      • Enable or disable the recycle bin for the current session

        The session-level setting applies only to the current session.

        obclient [(none)]> SET @@recyclebin = on;
        
        obclient [(none)]> SET @@recyclebin = off;
        

        or

        obclient [(none)]> SET @@recyclebin = 1;
        
        obclient [(none)]> SET @@recyclebin = 0;
        

        or

        obclient [(none)]> SET @@recyclebin = true;
        
        obclient [(none)]> SET @@recyclebin = false;
        

    References

    For more information about the recycle bin, see the following topics:

    • Recycle bin overview

    • View objects in the recycle bin

    • Purge the recycle bin

    • Restore objects from the recycle bin

    Previous topic

    Overview
    Last

    Next topic

    View objects in the recycle bin
    Next
    What is on this page
    Background information
    Procedure
    References