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

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive 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.2
    iconOceanBase Database
    SQL - V 4.2.2
    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

    Overview

    Last Updated:2026-04-15 08:27:14  Updated
    Share
    What is on this page
    Log archiving architecture
    Log archiving modes
    Archiving status
    Structure of archive logs
    Log group
    Piece
    Attributes of pieces
    START_SCN
    END_SCN
    CHECKPOINT_SCN
    STATUS
    FILE_STATUS

    folded

    Share

    This topic describes the concepts and internal logic of log archiving.

    Log archiving architecture

    Log archiving is a process of storing the redo logs generated in the database to other media such as Network File System (NFS) and Alibaba Cloud Object Storage Service (OSS) so that the redo operation history of the database can be stored for a longer period. OceanBase Database uses a multi-tenant architecture. You can separately enable log archiving for each tenant. Log archiving operations in different tenants are independent of each other.

    In addition, OceanBase Database is a native distributed database. Therefore, archiving operations for different log streams within a tenant are also independent of each other. The leader of a log stream is responsible for log archiving. Each log stream is archived only once. During archiving, the leader of RootService calculates the archiving progress of the current tenant based on the archiving progress of each log stream.

    The following figure shows the log archiving architecture.

    Log archiving architecture

    Log archiving modes

    Two log archiving modes are supported: ARCHIVELOG and NOARCHIVELOG. You can initiate a log archiving job for a tenant only when the tenant is in ARCHIVELOG mode.

    Archiving status

    In log archiving, a collection of finite-state machines is used to describe the log archiving status of each tenant. You can view the archiving status of the sys tenant from the STATUS column in the oceanbase.CDB_OB_ARCHIVELOG view. You can view the archiving status of a user tenant from the STATUS column in the oceanbase.DBA_OB_ARCHIVELOG view in MySQL mode or from the STATUS column in the sys.DBA_OB_ARCHIVELOG view in Oracle mode.

    The following table describes the archiving status.

    State
    Description
    PREPARE The initial state for enabling log archiving.
    BEGINNING Log archiving is being started. In this state, each log stream is instructed to start archiving.
    DOING Log archiving is in progress. In this state, the log checkpoint constantly advances consecutively. In other words, the value of checkpoint_scn increments consecutively.
    INTERRUPTED Log archiving is interrupted. The log archiving state machine enters this state when log archiving is interrupted for at least one log stream.
    SUSPENDING Log archiving is being suspended.
    SUSPEND Log archiving is suspended.
    STOPPING Log archiving is being stopped.
    STOP Log archiving is stopped.

    Structure of archive logs

    Log group

    In OceanBase Database, each archive log record is a collection of logs, including several log entries. The archive log record is called a log group. Each log entry has a system change number (SCN). The log group also has an SCN, which is the largest one of the SCNs of all log entries. In log archiving, log groups are organized and managed in the archiving media.

    Piece

    OceanBase Database organizes and manages archived logs by piece. A piece is a complete collection of logs of a tenant within a consecutive period. The range of SCNs of logs in a piece is a left-closed and right-open interval. This implies the following points:

    • One piece contains the logs of a consecutive period, such as 1d or 2d. This period is specified by the PIECE_SWITCH_INTERVAL attribute in the LOG_ARCHIVE_DEST parameter.

    • The logs in a piece are complete. The logs generated by all log streams of this tenant within the specified period are organized in this piece.

    Assume that the PIECE_SWITCH_INTERVAL attribute in the LOG_ARCHIVE_DEST parameter is set to 1d. OceanBase Database will generate a piece every other day. Except for the last piece in each round of archiving, each piece contains the complete logs of one day. All logs are archived to this piece based on the specified rules. For example, after log archiving is enabled at '2022-06-01 06:00:00.000000', the range of SCNs of logs in the first complete piece generated for the current tenant is ['2022-06-01 06:00:00.000000', '2022-06-02 06:00:00.000000').

    Attributes of pieces

    A piece has the following attributes: START_SCN, END_SCN, CHECKPOINT_SCN, STATUS and FILE_STATUS.

    START_SCN

    START_SCN specifies the start SCN of consecutive logs in the piece.

    END_SCN

    END_SCN specifies the end SCN of the piece. The value of END_SCN minus the value of START_SCN is equal to the value of the PIECE_SWITCH_INTERVAL attribute.

    For example, the PIECE_SWITCH_INTERVAL attribute in the LOG_ARCHIVE_DEST parameter is set to 1d, and log archiving is enabled at 2022-06-01 06:00:00. For the first piece generated during this round of archiving, START_SCN is '2022-06-01 06:00:00', and END_SCN is '2022-06-02 06:00:00'. All log groups generated at '2022-06-01 06:00:00' or later but earlier than '2022-06-02 06:00:00' are archived to this piece. For the second piece, START_SCN is '2022-06-02 06:00:00', and END_SCN is '2022-06-03 06:00:00'.

    In the same round of archiving, log groups whose SCNs fall within the range of [START_SCN, END_SCN) belong to the same piece, but log entries whose SCNs fall within the range of [START_SCN, END_SCN) do not necessarily belong to the same piece.

    For example, [START_SCN, END_SCN) of piece 1 is ['2022-06-01 06:00:00', '2022-06-02 06:00:00'), and a log group contains two log entries that correspond to SCNs '2022-06-02 05:59:59' and '2022-06-02 06:00:01' respectively. The SCN of the log group is the larger one of the SCNs of the two log entries and therefore is '2022-06-02 06:00:01', but the log entry with this SCN belongs to the next piece.

    CHECKPOINT_SCN

    CHECKPOINT_SCN specifies the largest SCN of consecutive logs in the piece, namely, the largest SCN of all log groups in the piece. All log groups whose SCNs fall within the range of [START_SCN, CHECKPOINT_SCN] are archived to this piece.

    STATUS

    STATUS specifies the status of the piece. The following table describes the possible states.

    State
    Description
    ACTIVE An active piece, to which the system is archiving logs.
    FROZEN A frozen piece. The logs in the piece are complete and no more logs will be archived to it.

    FILE_STATUS

    FILE_STATUS describes the status of piece files. The following table describes the possible states.

    State
    Description
    AVAILABLE The data in the piece is intact and complete, not deleted or damaged.
    INCOMPLETE The data in the piece is incomplete. The data of some log streams is missing.
    DELETING The piece has expired and is being deleted.
    DELETED The piece is deleted.
    BROKEN The data in the piece is damaged.

    Previous topic

    Deploy NFS
    Last

    Next topic

    Prepare for log archiving
    Next
    What is on this page
    Log archiving architecture
    Log archiving modes
    Archiving status
    Structure of archive logs
    Log group
    Piece
    Attributes of pieces
    START_SCN
    END_SCN
    CHECKPOINT_SCN
    STATUS
    FILE_STATUS