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.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 & 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. V4.2.5
    iconOceanBase Database
    SQL - V 4.2.5
    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

    Query the backup cleanup history

    Last Updated:2026-04-09 09:38:52  Updated
    Share
    What is on this page
    Query views for the backup cleanup history

    folded

    Share

    After a cleanup strategy is configured and automatic cleanup is triggered, expired backup data will be automatically cleaned up based on the strategy. You can query views for the backup cleanup history.

    Query views for the backup cleanup history

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

    2. Query historical cleanup jobs.

      • Query the historical backup cleanup jobs.

        You can query the oceanbase.CDB_OB_BACKUP_DELETE_JOB_HISTORY view from the sys tenant for the historical cleanup jobs of all tenants. You can query the oceanbase.DBA_OB_BACKUP_DELETE_JOB_HISTORY view from a MySQL tenant or the sys.DBA_OB_BACKUP_DELETE_JOB_HISTORY view from an Oracle tenant for the historical cleanup jobs of the current tenant.

        To query the historical cleanup jobs from the sys tenant, execute the following statement:

        obclient> SELECT * FROM CDB_OB_BACKUP_DELETE_JOB_HISTORY\G
        *************************** 1. row ***************************
                       TENANT_ID: 1002
                          JOB_ID: 7
                     INCARNATION: 1
             INITIATOR_TENANT_ID: 1002
                INITIATOR_JOB_ID: 7
              EXECUTOR_TENANT_ID: 1002
                            TYPE: DELETE OBSOLETE BACKUP
                       PARAMETER: 2022-05-31 12:09:40.060284
                       JOB_LEVEL: USER_TENANT
                 START_TIMESTAMP: 2022-06-01 12:09:53.389512
                   END_TIMESTAMP: 2022-06-01 12:10:36.829576
                          STATUS: COMPLETED
                      TASK_COUNT: 2
              SUCCESS_TASK_COUNT: 2
                          RESULT: 0
                         COMMENT:
        1 row in set
        

        According to the query result, the user tenant with the tenant ID 1002 initiated a job for cleaning up expired backup data at 2022-06-01 12:09:53.389512, and the job was completed at 2022-06-01 12:10:36.829576. The success rate of the tasks under the job is 100%, which is calculated by using the following formula: TASK_COUNT/SUCCESS_TASK_COUNT × 100%. The value of RESULT is 0, indicating that the job was successfully executed.

      • Query historical backup set/back piece cleanup tasks.

        You can query the oceanbase.CDB_OB_BACKUP_DELETE_TASK_HISTORY view from the sys tenant for the historical cleanup tasks of all tenants. You can query the oceanbase.DBA_OB_BACKUP_DELETE_TASK_HISTORY view from a MySQL tenant or the sys.DBA_OB_BACKUP_DELETE_TASK_HISTORY view from an Oracle tenant for the historical cleanup tasks of the current tenant.

        To query historical backup set/back piece cleanup tasks from the sys tenant, execute the following statement:

        obclient> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_TASK_HISTORY\G
        *************************** 1. row ***************************
                 TENANT_ID: 1002
                   TASK_ID: 4
               INCARNATION: 1
                    JOB_ID: 7
                 TASK_TYPE: BACKUP SET
                        ID: 1
                  ROUND_ID: 0
                   DEST_ID: 1002
           START_TIMESTAMP: 2022-06-01 12:09:50.800772
             END_TIMESTAMP: 2022-06-01 12:09:54.954691
                    STATUS: COMPLETED
            TOTAL_LS_COUNT: 2
           FINISH_LS_COUNT: 2
                    RESULT: 0
                   COMMENT:
                      PATH: file:///data/nfs/backup/data
        *************************** 2. row ***************************
                 TENANT_ID: 1002
                   TASK_ID: 5
               INCARNATION: 1
                    JOB_ID: 7
                 TASK_TYPE: BACKUP PIECE
                        ID: 1
                  ROUND_ID: 1
                   DEST_ID: 1001
           START_TIMESTAMP: 2022-06-01 12:09:50.968413
             END_TIMESTAMP: 2022-06-01 12:09:56.283804
                    STATUS: COMPLETED
            TOTAL_LS_COUNT: 2
           FINISH_LS_COUNT: 2
                    RESULT: 0
                   COMMENT:
                      PATH: file:///data/nfs/backup/archive
        2 rows in set
        

        According to the query result, the backup file of the data backup with backup_set_id=1 in the destination file:///data/nfs/backup/data was deleted at 2022-06-01 12:09:54.954691. In the destination file:///data/nfs/backup/archive, the backup file of archive logs with round_id=1/backup_piece_id=1 was deleted at 2022-06-01 12:09:56.283804. You can query the information about initiated cleanup tasks in the job-level view based on JOB_ID.

    Previous topic

    Query the backup cleanup progress
    Last

    Next topic

    Backup cleanup parameter
    Next
    What is on this page
    Query views for the backup cleanup history