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

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

    Log storage service

    Last Updated:2024-12-02 03:48:29  Updated
    share
    What is on this page
    Working modes of log streams
    View the working mode of log streams of a primary tenant
    View the working mode of log streams of a standby tenant
    Roles of log stream replicas
    Storage space management

    folded

    share

    The log storage service provides highly available and reliable log storage and read/write capabilities for the Physical Standby Database solution. The log storage service supports both a single replica and multiple replicas and provides high availability based on the Paxos protocol.

    Working modes of log streams

    Log storage services for primary and standby tenants work in two different modes.

    • APPEND mode

      Primary tenants support the APPEND mode. In this mode, the log stream leader of a primary tenant receives data written by upper-layer modules such as transactions and DDL operations, and synchronizes and persists the data across multiple replicas of the primary tenant based on the Paxos protocol. If a failure occurs during data synchronization, persistence of the written data may fail. The log storage service automatically handles various failures to provide high availability.

      During data synchronization, a unique log sequence number (LSN) and system change number (SCN) are generated for each log entry in the primary tenant. The LSN indicates the physical location of the log entry in the storage service. The SCN indicates the time sequence relationship of the log entry in the storage service. An upper-layer service can determine the sequence of logs in multiple log streams based on SCNs.

    • RAW_WRITE mode

      Standby tenants support the RAW_WRITE mode. In this mode, the log stream leader of a standby tenant rejects data written by upper-layer modules. It only allows the log transfer service to synchronize physical logs from the primary tenant. The content, LSNs, and SCNs of the physical logs are generated by the primary tenant.

      The physical logs synchronized from the primary tenant are synchronized and persisted across multiple replicas of the log storage service of the standby tenant based on the Paxos protocol.

    In addition to the APPEND and RAW_WRITE modes, log streams can also work in PREPARE_FLASHBACK or FLASHBACK mode during a failover operation. For more information about the failover operation, see Failover.

    View the working mode of log streams of a primary tenant

    1. Log in as the administrator to the primary tenant or the sys tenant of the cluster where the primary tenant resides.

    2. Execute the following statement to query the value of TENANT_ID of the primary tenant.

      • sys tenant

        SELECT TENANT_ID,TENANT_NAME FROM oceanbase.DBA_OB_TENANTS;
        

        The query result is as follows:

        +-----------+-------------+
        | TENANT_ID | TENANT_NAME |
        +-----------+-------------+
        |         1 | sys         |
        |      1001 | META$1002   |
        |      1002 | mysql       |
        |      1003 | META$1004   |
        |      1004 | oracle      |
        +-----------+-------------+
        5 rows in set
        
      • Primary tenant

        • MySQL mode

          SELECT TENANT_ID,TENANT_NAME FROM oceanbase.DBA_OB_TENANTS;
          

          The query result is as follows:

          +-----------+-------------+
          | TENANT_ID | TENANT_NAME |
          +-----------+-------------+
          |      1002 | mysql       |
          +-----------+-------------+
          1 row in set
          
        • Oracle mode

          SELECT TENANT_ID,TENANT_NAME FROM SYS.DBA_OB_TENANTS;
          

          The query result is as follows:

          +-----------+-------------+
          | TENANT_ID | TENANT_NAME |
          +-----------+-------------+
          |      1004 | oracle      |
          +-----------+-------------+
          1 row in set
          
    3. Execute the following statement to query the working mode of log streams of the primary tenant.

      • MySQL mode

        SELECT TENANT_ID, LS_ID, SVR_IP, SVR_PORT, ROLE, ACCESS_MODE FROM oceanbase.GV$OB_LOG_STAT WHERE TENANT_ID = 1002;
        
      • Oracle mode

        SELECT TENANT_ID, LS_ID, SVR_IP, SVR_PORT, ROLE, ACCESS_MODE FROM SYS.GV$OB_LOG_STAT WHERE TENANT_ID = 1004;
        

      The query result is as follows:

    Notice

    By default, log streams work in RAW_WRITE mode. Therefore, when a load balancing task is being executed in the primary tenant, the ACCESS_MODE of a log stream replica is also RAW_WRITE.

    +-----------+-------+-------------+----------+----------+-------------+
    | TENANT_ID | LS_ID | SVR_IP      | SVR_PORT | ROLE     | ACCESS_MODE |
    +-----------+-------+-------------+----------+----------+-------------+
    |      1002 |     1 | xx.xx.xx.xx |    17854 | LEADER   | APPEND      |
    |      1002 |  1001 | xx.xx.xx.xx |    17854 | LEADER   | APPEND      |
    |      1002 |     1 | xx.xx.xx.xx |    17858 | FOLLOWER | APPEND      |
    |      1002 |  1001 | xx.xx.xx.xx |    17858 | FOLLOWER | APPEND      |
    |      1002 |     1 | xx.xx.xx.xx |    17856 | FOLLOWER | APPEND      |
    |      1002 |  1001 | xx.xx.xx.xx |    17856 | FOLLOWER | APPEND      |
    +-----------+-------+-------------+----------+----------+-------------+
    6 rows in set
    

    View the working mode of log streams of a standby tenant

    1. Log in as the administrator to the standby tenant or the sys tenant of the cluster where the standby tenant resides.

    2. Execute the following statement to query the value of TENANT_ID of the standby tenant:

      • sys tenant

        SELECT TENANT_ID,TENANT_NAME FROM oceanbase.DBA_OB_TENANTS;
        

        The query result is as follows:

        +-----------+-------------+
        | TENANT_ID | TENANT_NAME |
        +-----------+-------------+
        |         1 | sys         |
        |      1003 | META$1002   |
        |      1004 | mysql       |
        |      1005 | META$1004   |
        |      1006 | oracle      |
        +-----------+-------------+
        5 rows in set
        
      • Standby tenant

        • MySQL mode

          SELECT TENANT_ID,TENANT_NAME FROM oceanbase.DBA_OB_TENANTS;
          

          The query result is as follows:

          +-----------+-------------+
          | TENANT_ID | TENANT_NAME |
          +-----------+-------------+
          |      1004 | mysql       |
          +-----------+-------------+
          1 row in set
          
        • Oracle mode

          SELECT TENANT_ID,TENANT_NAME FROM SYS.DBA_OB_TENANTS;
          

          The query result is as follows:

          +-----------+-------------+
          | TENANT_ID | TENANT_NAME |
          +-----------+-------------+
          |      1006 | oracle      |
          +-----------+-------------+
          1 row in set
          
    3. Execute the following statement to query the working mode of log streams of the standby tenant.

      • MySQL mode

        SELECT TENANT_ID, LS_ID, SVR_IP, SVR_PORT, ROLE, ACCESS_MODE FROM oceanbase.GV$OB_LOG_STAT WHERE TENANT_ID = 1004;
        
      • Oracle mode

        SELECT TENANT_ID, LS_ID, SVR_IP, SVR_PORT, ROLE, ACCESS_MODE FROM SYS.GV$OB_LOG_STAT WHERE TENANT_ID = 1006;
        

      The query result is as follows:

      +-----------+-------+-------------+----------+----------+-------------+
      | TENANT_ID | LS_ID | SVR_IP      | SVR_PORT | ROLE     | ACCESS_MODE |
      +-----------+-------+-------------+----------+----------+-------------+
      |      1004 |     1 | xx.xx.xx.xx |    17858 | FOLLOWER | RAW_WRITE   |
      |      1004 |  1001 | xx.xx.xx.xx |    17858 | FOLLOWER | RAW_WRITE   |
      |      1004 |     1 | xx.xx.xx.xx |    17854 | LEADER   | RAW_WRITE   |
      |      1004 |  1001 | xx.xx.xx.xx |    17854 | LEADER   | RAW_WRITE   |
      |      1004 |     1 | xx.xx.xx.xx |    17856 | FOLLOWER | RAW_WRITE   |
      |      1004 |  1001 | xx.xx.xx.xx |    17856 | FOLLOWER | RAW_WRITE   |
      +-----------+-------+-------------+----------+----------+-------------+
      6 rows in set
      

    Roles of log stream replicas

    Replicas in a Paxos group of a primary or standby tenant have one of the two roles: leader and follower. You can query the ROLE field in the GV$OB_LOG_STAT view to check whether a log stream replica is a leader or a follower.

    Business data of a primary tenant is written to the log stream leader and then synchronized to all followers. The log stream leader of a standby tenant synchronizes logs from the primary tenant by using the log transfer service and then synchronizes the logs to the followers in the Paxos group.

    Storage space management

    The log storage service separately manages the storage space of each primary or standby tenant.

    When you create a unit specification for a primary or standby tenant, you can use the LOG_DISK_SIZE parameter in the CREATE RESOURCE UNIT statement to specify the storage space of the log disk. If you do not specify the LOG_DISK_SIZE parameter, the default size of the log disk is three times the memory size, and the minimum size of the log disk is 2 GB. For more information about how to create a unit, see Create a tenant.

    You can check the log disk storage space that is available for a primary or standby tenant and that is already used by the primary or standby tenant by querying the GV$OB_UNITS view.

    1. Log in as the administrator to the primary or standby tenant or the sys tenant of the cluster where the primary or standby tenant resides.

    2. Execute the following statement to query the value of TENANT_ID of the tenant.

      • sys tenant

        SELECT TENANT_ID,TENANT_NAME FROM oceanbase.DBA_OB_TENANTS;
        

        The query result is as follows:

        +-----------+-------------+
        | TENANT_ID | TENANT_NAME |
        +-----------+-------------+
        |         1 | sys         |
        |      1003 | META$1002   |
        |      1004 | mysql       |
        |      1005 | META$1004   |
        |      1006 | oracle      |
        +-----------+-------------+
        5 rows in set
        
      • Primary or standby tenant

        • MySQL mode

          SELECT TENANT_ID,TENANT_NAME FROM oceanbase.DBA_OB_TENANTS;
          

          The query result is as follows:

          +-----------+-------------+
          | TENANT_ID | TENANT_NAME |
          +-----------+-------------+
          |      1004 | mysql       |
          +-----------+-------------+
          1 row in set
          
        • Oracle mode

          SELECT TENANT_ID,TENANT_NAME FROM SYS.DBA_OB_TENANTS;
          

          The query result is as follows:

          +-----------+-------------+
          | TENANT_ID | TENANT_NAME |
          +-----------+-------------+
          |      1006 | oracle      |
          +-----------+-------------+
          1 row in set
          
    3. Execute the following statement to query the log disk storage space available for the primary or standby tenant and the actual usage.

      • MySQL mode

        SELECT SVR_IP, SVR_PORT, TENANT_ID, LOG_DISK_SIZE, LOG_DISK_IN_USE FROM oceanbase.GV$OB_UNITS WHERE TENANT_ID = 1004;
        

        The query result is as follows:

        +----------------+----------+-----------+---------------+-----------------+
        | SVR_IP         | SVR_PORT | TENANT_ID | LOG_DISK_SIZE | LOG_DISK_IN_USE |
        +----------------+----------+-----------+---------------+-----------------+
        | xx.xx.xx.xx    |     2882 |      1004 |   17394617549 |      1029179660 |
        | xx.xx.xx.xx    |    17856 |      1004 |   17394617549 |      1029177240 |
        | xx.xx.xx.xx    |    17858 |      1004 |   17394617549 |      1029177966 |
        +----------------+----------+-----------+---------------+-----------------+
        3 rows in set
        
      • Oracle mode

        SELECT SVR_IP, SVR_PORT, TENANT_ID, LOG_DISK_SIZE, LOG_DISK_IN_USE FROM SYS.GV$OB_UNITS WHERE TENANT_ID = 1006;
        

        The query result is as follows:

        +-------------+----------+-----------+---------------+-----------------+
        | SVR_IP      | SVR_PORT | TENANT_ID | LOG_DISK_SIZE | LOG_DISK_IN_USE |
        +-------------+----------+-----------+---------------+-----------------+
        | xx.xx.xx.xx |    17854 |      1006 |    5798205850 |      1437200613 |
        | xx.xx.xx.xx |    17856 |      1006 |    5798205850 |      1437196109 |
        | xx.xx.xx.xx |    17858 |      1006 |    5798205850 |      1437196109 |
        +-------------+----------+-----------+---------------+-----------------+
        3 rows in set
        

    You can also adjust the unit specification of the primary or standby tenant to resize the storage space of the log disk. For more information, see Modify the unit configs for a tenant.

    Previous topic

    Specify log compression
    Last

    Next topic

    Overview of tenant roles
    Next
    What is on this page
    Working modes of log streams
    View the working mode of log streams of a primary tenant
    View the working mode of log streams of a standby tenant
    Roles of log stream replicas
    Storage space management