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

    oceanbase.CDB_OB_TENANT_EVENT_HISTORY

    Last Updated:2026-04-27 03:14:13  Updated
    share
    What is on this page
    Purpose
    Columns
    Typical tenant events
    Sample query
    References

    folded

    share

    Note

    This view was introduced in OceanBase Database V4.2.0.

    Purpose

    The oceanbase.CDB_OB_TENANT_EVENT_HISTORY view displays the historical operation records of all tenants in the current cluster.

    Columns

    Column
    Type
    Nullable?
    Description
    TENANT_ID bigint(20) NO The ID of the tenant.
    TIMESTAMP timestamp(6) NO The time when the operation was executed, in µs.
    MODULE varchar(256) NO The name of the module.
    EVENT varchar(256) NO The name of the event.
    NAME1 varchar(256) YES The name of the first attribute.
    VALUE1 longtext YES The value of the first attribute.
    NAME2 varchar(256) YES The name of the second attribute.
    VALUE2 longtext YES The value of the second attribute.
    NAME3 varchar(256) YES The name of the third attribute.
    VALUE3 longtext YES The value of the third attribute.
    NAME4 varchar(256) YES The name of the fourth attribute.
    VALUE4 longtext YES The value of the fourth attribute.
    NAME5 varchar(256) YES The name of the fifth attribute.
    VALUE5 longtext YES The value of the fifth attribute.
    NAME6 varchar(256) YES The name of the sixth attribute.
    VALUE6 longtext YES The value of the sixth attribute.
    EXTRA_INFO longtext YES The additional information.
    SVR_IP varchar(46) YES The IP address of the OBServer node where the operation was executed.
    SVR_PORT bigint(20) YES The port number of the OBServer node where the operation was executed.
    TRACE_ID varchar(64) YES The trace ID of the operation.
    COST_TIME bigint(20) YES The amount of time taken to execute the operation.
    RET_CODE bigint(20) YES The error code for the operation. The value 0 indicates that the operation was successfully executed.
    ERROR_MSG varchar(512) YES The error message.

    Typical tenant events

    Typical tenant events belong to the TENANT ROLE CHANGE and SERVICE NAME modules.

    When you perform operations of different modules, the NAME and VALUE attributes of the events vary.

    TENANT ROLE CHANGE

    The TENANT ROLE CHANGE module contains three operations: FAILOVER TO PRIMARY, SWITCHOVER TO PRIMARY, and SWITCHOVER TO STANDBY.

    • FAILOVER TO PRIMARY

      When you initiate the FAILOVER TO PRIMARY operation, the tenant event record table records the following events:

      • FAILOVER TO PRIMARY START

        This event records the time when the ALTER SYSTEM ACTIVATE STANDBY statement was executed and the tenant information.

        Attribute
        Value
        NAME1:STMT_STR VALUE1: the statement that you entered.
        NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the statement was initiated.
      • FAILOVER TO PRIMARY END

        This event records the time when the execution of the ALTER SYSTEM ACTIVATE STANDBY statement was completed, information of the tenant where the operation was performed, final status of the log stream, and amount of time taken by key steps.

        Attribute
        Value
        NAME1:STMT_STR VALUE1: the statement that you entered.
        NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the execution of the statement was completed.
        NAME3:FAILOVER_SCN VALUE3: the synchronization system change number (SCN) of the tenant after the failover.
        NAME4:COST_DETAIL VALUE4: the amount of time taken by each phase during the execution of the statement, in μs.
        NAME5:ALL_LS VALUE5: the status of all log streams of the tenant when ACCESS MODE is modified.
    • SWITCHOVER TO PRIMARY

      When you initiate the SWITCHOVER TO PRIMARY operation, the tenant event record table records the following major events:

      • SWITCHOVER TO PRIMARY START

        This event records the time when the ALTER SYSTEM SWITCHOVER TO PRIMARY statement was executed and the tenant information.

        Attribute
        Value
        NAME1:STMT_STR VALUE1: the statement that you entered.
        NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the statement was initiated.
      • WAIT LOG SYNC

        This event records the log synchronization information of the tenant. When you execute the ALTER SYSTEM SWITCHOVER TO PRIMARY statement, the tenant waits until all latest log records are synchronized from the current primary tenant, to ensure data consistency and integrity.

        Attribute
        Value
        NAME1:IS_SYS_LS_SYNCED VALUE1: indicates whether the system log streams of the tenant are synchronized.
        NAME2:IS_ALL_LS_SYNCED VALUE2: indicates whether all log streams of the tenant are synchronized.
        NAME3:NON_SYNC_INFO VALUE3: the number of log streams that are not synchronized and the information about five log streams that are synchronized most slowly.
      • SWITCHOVER_TO_PRIMARY_END

        This event records the time when the execution of the ALTER SYSTEM SWITCHOVER TO PRIMARY statement was completed, information of the tenant where the operation was performed, final status of the log stream, and amount of time taken by key steps.

        Attribute
        Value
        NAME1:STMT_STR VALUE1: the statement that you entered.
        NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the execution of the statement was completed.
        NAME3:SWITCHOVER_SCN VALUE3: the synchronization SCN of the tenant after the switchover.
        NAME4:COST_DETAIL VALUE4: the amount of time taken by each phase during the execution of the statement, in μs.
        NAME5:ALL_LS VALUE5: the status of all log streams of the tenant when ACCESS MODE is modified.
    • SWITCHOVER TO STANDBY

      When you initiate the SWITCHOVER TO STANDBY operation, the tenant event record table records the following major events:

      • SWITCHOVER TO STANDBY START

        This event records the time when the ALTER SYSTEM SWITCHOVER TO STANDBY statement was executed and the tenant information.

        Attribute
        Value
        NAME1:STMT_STR VALUE1: the statement that you entered.
        NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the statement was initiated.
      • SWITCHOVER TO STANDBY END

        This event records the time when the execution of the ALTER SYSTEM SWITCHOVER TO STANDBY statement was completed, information of the tenant where the operation was performed, final status of the log stream, and amount of time taken by key steps.

        Attribute
        Value
        NAME1:STMT_STR VALUE1: the statement that you entered.
        NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the execution of the statement was completed.
        NAME3:SWITCHOVER_SCN VALUE3: the synchronization SCN of the tenant after the switchover.
        NAME4:COST_DETAIL VALUE4: the amount of time taken by each phase during the execution of the statement, in μs.
        NAME5:ALL_LS VALUE5: the status of all log streams of the tenant when ACCESS MODE is modified.

    SERVICE NAME

    The SERVICE NAME module contains four operations: CREATE SERVICE, DELETE SERVICE, START SERVICE, and STOP SERVICE.

    You can query these operations by TRACE_ID. For example, you can query whether a broadcast was triggered when a service was created based on the TRACE_ID value of the service creation event.

    • CREATE SERVICE

      When you initiate the CREATE SERVICE operation for a user tenant, the following events are recorded:

      • BROADCAST SERVICE NAME

        This event records the broadcast content, list of target OBServer nodes, and list of OBServer nodes that successfully received the broadcast. When you execute the ALTER SYSTEM CREATE SERVICE statement on an OBServer node, the node broadcasts the current service names of the tenant to all OBServer nodes where the units of the tenant reside.

        Attribute
        Value
        NAME1:EPOCH VALUE1: the versions of all the current service names of the tenant in the current broadcast.
        NAME2:TARGET_SERVICE_NAME_ID VALUE2: the ID of the service name that triggered the broadcast event.
        NAME3:SERVICE_NAME_LIST VALUE3: all the current service names of the tenant.
        NAME4:SERVICE_NAME_COMMAND_TYPE VALUE4: the type of the operation that triggered the broadcast event.
        NAME5:TARGET_SERVERS_LIST VALUE5: the target OBServer nodes of the broadcast, which are all the non-permanently-offline OBServer nodes where the units of the tenant reside.
        NAME6:SUCCESS_SERVERS_LIST VALUE6: the OBServer nodes that successfully received the broadcast.
      • CREATE SERVICE

        This event records the name of the service to be created and the information about the created service. It is generated after the execution of the ALTER SYSTEM CREATE SERVICE statement is completed.

        Attribute
        Value
        NAME1:SERVICE_NAME_STRING VALUE1: the name of the service to be created.
        NAME2:CREATED_SERVICE_NAME VALUE2: the information about the created service.
    • DELETE SERVICE

      When you initiate the DELETE SERVICE operation for a user tenant, the following event is recorded:

      • DELETE SERVICE

        This event records the information at the time when the statement was initiated. It is generated after the execution of the ALTER SYSTEM DELETE SERVICE statement is completed.

        Attribute
        Value
        NAME1:DELETED_SERVICE_NAME VALUE1: the name of the service to be deleted.
    • START SERVICE

      When you initiate the START SERVICE operation for a user tenant, the following events are recorded:

      • BROADCAST SERVICE NAME

        This event records the broadcast content, list of target OBServer nodes, and list of OBServer nodes that successfully received the broadcast. When you execute the ALTER SYSTEM SERVICE NAME statement on an OBServer node, the node broadcasts the current service names of the tenant to all OBServer nodes where the units of the tenant reside.

        Attribute
        Value
        NAME1:EPOCH VALUE1: the versions of all the current service names of the tenant in the current broadcast.
        NAME2:TARGET_SERVICE_NAME_ID VALUE2: the ID of the service name that triggered the broadcast event.
        NAME3:SERVICE_NAME_LIST VALUE3: all the current service names of the tenant.
        NAME4:SERVICE_NAME_COMMAND_TYPE VALUE4: the type of the operation that triggered the broadcast event.
        NAME5:TARGET_SERVERS_LIST VALUE5: the target OBServer nodes of the broadcast, which are all the non-permanently-offline OBServer nodes where the units of the tenant reside.
        NAME6:SUCCESS_SERVERS_LIST VALUE6: the OBServer nodes that successfully received the broadcast.
      • START SERVICE

        This event records the information at the time when the statement was initiated and when the execution of the statement was completed. It is generated after the execution of the ALTER SYSTEM START SERVICE statement is completed.

        Attribute
        Value
        NAME1:SERVICE_NAME_BEFORE VALUE1: the service name before the service was started.
        NAME2:SERVICE_NAME_AFTER VALUE2: the service name after the service was started.
    • STOP SERVICE

      When you initiate the STOP SERVICE operation for a user tenant, the following events are recorded:

      • KILL CONNECTIONS OF SERVICE NAME

        When you execute the ALTER SYSTEM SERVICE NAME statement, all OBServer nodes where the units of the tenant reside close the connections established on them based on the service name, and an event is recorded for each of the OBServer nodes in the tenant event view. If no connection established based on the service name exists on an OBServer node, this event is not recorded for the OBServer node.

        Attribute
        Value
        NAME1:SERVICE_NAME VALUE1: the name of the service to be stopped.
        NAME2:KILLED_CONNECTIONS_COUNT VALUE2: the number of connections closed.
        NAME3:KILLED_CONNECTIONS_LIST VALUE3: the IDs of the connections closed.
      • BROADCAST SERVICE NAME

        This event records the broadcast content, list of target OBServer nodes, and list of OBServer nodes that successfully received the broadcast. When you execute the ALTER SYSTEM STOP SERVICE statement on an OBServer node, the node broadcasts the current service names of the tenant to all OBServer nodes where the units of the tenant reside.

        Attribute
        Value
        NAME1:EPOCH VALUE1: the versions of all the current service names of the tenant in the current broadcast.
        NAME2:TARGET_SERVICE_NAME _ID VALUE2: the ID of the service name that triggered the broadcast event.
        NAME3:SERVICE_NAME_LIST VALUE3: all the current service names of the tenant.
        NAME4:SERVICE_NAME_COMMAND_TYPE VALUE4: the type of the operation that triggered the broadcast event.
        NAME5:TARGET_SERVERS_LIST VALUE5: the target OBServer nodes of the broadcast, which are all the non-permanently-offline OBServer nodes where the units of the tenant reside.
        NAME6:SUCCESS_SERVERS_LIST VALUE6: the OBServer nodes that successfully received the broadcast.
      • STOP SERVICE

        This event records the information at the time when the statement was initiated and when the execution of the statement was completed. It is generated after the execution of the ALTER SYSTEM STOP SERVICE statement is completed.

        Attribute
        Value
        NAME1:SERVICE_NAME_BEFORE VALUE1: the service name before the service was stopped.
        NAME2:SERVICE_NAME_AFTER VALUE2: the service name after the service was stopped.

    Sample query

    obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_TENANT_EVENT_HISTORY WHERE TENANT_ID = 1002 AND EVENT = 'SWITCHOVER TO STANDBY END'\G
    

    The query result is as follows:

    *************************** 1. row ***************************
     TENANT_ID: 1002
     TIMESTAMP: 2023-12-14 14:33:20.321725
        MODULE: TENANT ROLE CHANGE
         EVENT: SWITCHOVER TO STANDBY END
         NAME1: STMT_STR
        VALUE1: ALTER SYSTEM SWITCHOVER TO STANDBY TENANT backup_mysql_tenant
         NAME2: TENANT_INFO
        VALUE2: {tenant_id:1002, tenant_role:"STANDBY", switchover_status:"NORMAL", switchover_epoch:1702535600271677, sync_scn:1702535620070597000, replayable_scn:1702535620070597000, readable_scn:1702535620070597000, recovery_until_scn:4611686018427387903, log_mode:"ARCHIVELOG", max_ls_id:1003}
         NAME3: SWITCHOVER_SCN
        VALUE3: 1702535620070597000
         NAME4: COST_DETAIL
        VALUE4: WAIT_LOG_END: 100190, CHANGE_ACCESS_MODE: 47261, OTHERS: 136839
         NAME5: ALL_LS
        VALUE5: NORMAL: 1, 1001, 1002, 1003
         NAME6: NULL
        VALUE6:
    EXTRA_INFO: NULL
        SVR_IP: 100.xx.xx.xx
      SVR_PORT: 13324
      TRACE_ID: Y340C64586BD4-00060C724AEB962B-0-0
     COST_TIME: 284290
      RET_CODE: 0
     ERROR_MSG: NULL
    1 row in set
    

    References

    • Create a service
    • Query the service status
    • Start a service
    • Stop a service
    • Delete a service

    Previous topic

    oceanbase.CDB_TAB_COL_STATISTICS
    Last

    Next topic

    oceanbase.CDB_TAB_COLS
    Next
    What is on this page
    Purpose
    Columns
    Typical tenant events
    Sample query
    References