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

    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.3.0
    iconOceanBase Database
    SQL - V 4.3.0
    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

    oceanbase.DBA_WR_ACTIVE_SESSION_HISTORY

    Last Updated:2026-04-15 08:30:02  Updated
    Share
    What is on this page
    Purpose
    Columns
    Sample query

    folded

    Share

    Purpose

    The oceanbase.DBA_WR_ACTIVE_SESSION_HISTORY view displays persisted Active Session History (ASH) data of the current tenant.

    Note

    This view is introduced since OceanBase Database V4.2.1.

    Columns

    Column
    Type
    Nullable?
    Description
    CLUSTER_ID bigint(20) NO The ID of the cluster.
    TENANT_ID bigint(20) NO The ID of the tenant.
    SNAP_ID bigint(20) NO The ID of the snapshot.
    SVR_IP varchar(46) NO The IP address of the OBServer node.
    SVR_PORT bigint(20) NO The port of the OBServer node.
    SAMPLE_ID bigint(20) NO The sampling ID.
    SESSION_ID bigint(20) NO The ID of the sampled session.
    SAMPLE_TIME timestamp(6) NO The sampling time.
    USER_ID bigint(20) YES The user ID of the sampled session.
    SESSION_TYPE tinyint(4) YES The type of the sampled session.
    • N: indicates a foreground session, namely, a user session.
    • Y: indicates a background session.
    SESSION_STATE varchar(7) NO The status of the session when it is being sampled. Valid values:
    • EVENT_NO == 0: ON CPU indicates that no wait event occurs and that the SQL logic is being executed.
    • EVENT_NO ≠ 0: WAITTING indicates that a wait event occurs. The wait details are provided in the EVENT field.
    SQL_ID varchar(32) YES The SQL ID.
    TRACE_ID varchar(64) YES The trace ID.
    EVENT_NO bigint(20) YES The internal number of the wait event, which is used for join query with other tables.
    TIME_WAITED bigint(20) YES The total wait time of the wait event, in μs.
    P1 bigint(20) YES The value of the first parameter of the wait event.
    P2 bigint(20) YES The value of the second parameter of the wait event.
    P3 bigint(20) YES The value of the third parameter of the wait event.
    SQL_PLAN_LINE_ID bigint(20) YES The ID of the SQL operator during sampling. If no operator is used, the value is NULL.
    TIME_MODEL bigint(20) unsigned YES The time model.
    IN_PARSE varchar(1) NO Indicates whether SQL parsing is being performed in the current session during sampling.
    IN_PL_PARSE varchar(1) NO Indicates whether SQL PL parsing is being performed in the current session during sampling.
    IN_PLAN_CACHE varchar(1) NO Indicates whether plan caching is being performed in the current session during sampling.
    IN_SQL_OPTIMIZE varchar(1) NO Indicates whether SQL tuning is being performed in the current session during sampling.
    IN_SQL_EXECUTION varchar(1) NO Indicates whether an SQL statement is being executed in the current session during sampling.
    IN_PX_EXECUTION varchar(1) NO Indicates whether parallel SQL execution is being performed in the current session during sampling. If the current session is in this state, it must be also in the IN_SQL_EXECUTION state.
    IN_SEQUENCE_LOAD varchar(1) NO Indicates whether values are being generated for an auto-increment column or a sequence in the current session during sampling.
    IN_COMMITTING varchar(1) NO Indicates whether the current sampling point is in the transaction commit phase.
    IN_STORAGE_READ varchar(1) NO Indicates whether the current sampling point is in the storage read phase.
    IN_STORAGE_WRITE varchar(1) NO Indicates whether the current sampling point is in the storage write phase.
    IN_REMOTE_DAS_EXECUTION varchar(1) NO Indicates whether the current sampling point is in the phase of remote execution by using direct access service (DAS).
    MODULE varchar(64) YES The MODULE value recorded in the current session when it is being sampled.
    ACTION varchar(64) YES The ACTION value recorded in the current session when it is being sampled.
    CLIENT_ID varchar(64) YES The CLIENT_ID value recorded in the current session when it is being sampled.
    BACKTRACE varchar(512) YES An auxiliary debugging field, which records the code call stack when an event occurs.
    PLAN_ID bigint(20) YES The plan ID of the sampled SQL statement in the plan cache, which is used to associate the sampling point with the plan.

    Sample query

    obclient [oceanbase]> SELECT * FROM oceanbase.DBA_WR_ACTIVE_SESSION_HISTORY limit 1;
    

    The query result is as follows:

      +------------+-----------+---------+----------------+----------+-----------+---------------+----------------------------+---------+--------------+---------------+--------+-------------------------+----------+----------+-------------+------+------+------+------------------+------------+----------+-------------+---------------+-----------------+------------------+-----------------+------------------+---------------+-----------------+------------------+-------------------------+----------------+---------------+--------+--------+-----------+-----------+---------+---------------+-------------------+------------------+------------------+----------------------+--------------------+-----------------------+---------------------------+-----------------------------+-----------------+---------------------+-----------------------+
      | CLUSTER_ID | TENANT_ID | SNAP_ID | SVR_IP         | SVR_PORT | SAMPLE_ID | SESSION_ID    | SAMPLE_TIME                | USER_ID | SESSION_TYPE | SESSION_STATE | SQL_ID | TRACE_ID                | EVENT_NO | EVENT_ID | TIME_WAITED | P1   | P2   | P3   | SQL_PLAN_LINE_ID | TIME_MODEL | IN_PARSE | IN_PL_PARSE | IN_PLAN_CACHE | IN_SQL_OPTIMIZE | IN_SQL_EXECUTION | IN_PX_EXECUTION | IN_SEQUENCE_LOAD | IN_COMMITTING | IN_STORAGE_READ | IN_STORAGE_WRITE | IN_REMOTE_DAS_EXECUTION | IN_FILTER_ROWS | PROGRAM       | MODULE | ACTION | CLIENT_ID | BACKTRACE | PLAN_ID | TM_DELTA_TIME | TM_DELTA_CPU_TIME | TM_DELTA_DB_TIME | TOP_LEVEL_SQL_ID | IN_PLSQL_COMPILATION | IN_PLSQL_EXECUTION | PLSQL_ENTRY_OBJECT_ID | PLSQL_ENTRY_SUBPROGRAM_ID | PLSQL_ENTRY_SUBPROGRAM_NAME | PLSQL_OBJECT_ID | PLSQL_SUBPROGRAM_ID | PLSQL_SUBPROGRAM_NAME |
      +------------+-----------+---------+----------------+----------+-----------+---------------+----------------------------+---------+--------------+---------------+--------+-------------------------+----------+----------+-------------+------+------+------+------------------+------------+----------+-------------+---------------+-----------------+------------------+-----------------+------------------+---------------+-----------------+------------------+-------------------------+----------------+---------------+--------+--------+-----------+-----------+---------+---------------+-------------------+------------------+------------------+----------------------+--------------------+-----------------------+---------------------------+-----------------------------+-----------------+---------------------+-----------------------+
      |      40001 |      1002 |       1 | xx.xx.xx.xx |    28824 |       640 | 2830383448064 | 2024-01-05 14:34:28.277178 |       0 |            1 | ON CPU        |        | Y0-0000000000000000-0-0 |        0 |       -1 |           0 |    0 |    0 |    0 |             NULL |          0 | N        | N           | N             | N               | N                | N               | N                | N             | N               | N                | N                       | N              | T1002_ObTimer | NULL   | NULL   | NULL      | NULL      |       0 |           825 |               825 |              825 | NULL             | N                    | N                  |                  NULL |                      NULL | NULL                        |            NULL |                NULL | NULL                  |
      +------------+-----------+---------+----------------+----------+-----------+---------------+----------------------------+---------+--------------+---------------+--------+-------------------------+----------+----------+-------------+------+------+------+------------------+------------+----------+-------------+---------------+-----------------+------------------+-----------------+------------------+---------------+-----------------+------------------+-------------------------+----------------+---------------+--------+--------+-----------+-----------+---------+---------------+-------------------+------------------+------------------+----------------------+--------------------+-----------------------+---------------------------+-----------------------------+-----------------+---------------------+-----------------------+
      1 row in set (0.095 sec)
    

    Previous topic

    oceanbase.CDB_WR_SNAPSHOT
    Last

    Next topic

    oceanbase.CDB_WR_ACTIVE_SESSION_HISTORY
    Next
    What is on this page
    Purpose
    Columns
    Sample query