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

    V$OB_ACTIVE_SESSION_HISTORY

    Last Updated:2026-04-15 08:27:15  Updated
    Share
    What is on this page
    Purpose
    Columns
    Example

    folded

    Share

    Note

    This view is introduced since OceanBase Database V4.2.2.

    Purpose

    The V$OB_ACTIVE_SESSION_HISTORY view displays the active session history of the current node.

    Columns

    Column
    Type
    Nullable?
    Description
    SVR_IP varchar(46) No The IP address of the server to which the sample belongs.
    SVR_PORT bigint(20) No The port number of the server to which the sample belongs.
    SAMPLE_ID bigint(20) No The unique ID of the sample.
    SAMPLE_TIME datetime No The sampling time.
    CON_ID bigint(20) No The ID of the tenant.
    USER_ID bigint(20) No The ID of the user whose session is sampled.
    SESSION_ID bigint(20) No The ID of the sampled session.
    SESSION_TYPE varchar(10) No The session type. Valid values:
    • FOREGROUND: a foreground session. A foreground session is also known as a user session.
    • BACKGROUND: a background session, which is not supported for now.
    SESSION_STATE varchar(7) No The session status. Valid values:
    • ON CPU: The SQL logic is being executed without waiting.
    • WAITING: Indicates that a wait event occurs. The wait details are provided in the EVENT field.
    SQL_ID varchar(32) No The ID of the SQL statement.
    PLAN_ID bigint(20) No The plan ID of the sampled SQL statement in the plan cache, which is used to associate the sampling point with the plan.
    TRACE_ID varchar(64) No The trace ID of the operator.
    EVENT varchar(64) No The description of the wait event.
    EVENT_NO bigint(20) No The internal number of the wait event, which is used for JOIN queries.
    EVENT_ID bigint(20) No The ID of the current wait event.
    P1TEXT varchar(64) No The name of the first parameter of the wait event. The parameter name varies based on the event.
    P1 bigint(20) No The value of the first parameter of the wait event.
    P2TEXT varchar(64) No The name of the second parameter of the wait event. The parameter name varies based on the event.
    P2 bigint(20) No The value of the second parameter of the wait event.
    P3TEXT varchar(64) No The name of the third parameter of the wait event. The parameter name varies based on the event.
    P3 bigint(20) No The value of the third parameter of the wait event.
    WAIT_CLASS varchar(64) No The class of the wait event.
    WAIT_CLASS_ID bigint(20) No The ID of the class of the wait event, which is used for JOIN queries.
    TIME_WAITED bigint(20) No The total wait time of the wait event, in μs.
    SQL_PLAN_LINE_ID bigint(20) No The ID of the SQL operator in the SQL plan when the session is being sampled.
    IN_PARSE varchar(1) No Indicates whether SQL parsing is being performed in the session during sampling.
    IN_PL_PARSE varchar(1) No Indicates whether SQL PL parsing is being performed in the session during sampling.
    IN_PLAN_CACHE varchar(1) No Indicates whether plan caching is being performed in the session during sampling.
    IN_SQL_OPTIMIZE varchar(1) No Indicates whether SQL parsing and tuning are being performed in the session during sampling.
    IN_SQL_EXECUTION varchar(1) No Indicates whether an SQL statement is being executed in the session during sampling.
    IN_PX_EXECUTION varchar(1) No Indicates whether parallel SQL execution is being performed in the session during sampling. If the session is in this state, it must also be in the state of SQL statement executing.
    IN_SEQUENCE_LOAD varchar(1) No Indicates whether values are being generated for an auto-increment column or a sequence in the 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).
    IN_FILTER_ROWS varchar(1) No Indicates whether the current sampling point is in the phase of storage push-down execution.
    PROGRAM varchar(64) No The name of the program being executed at the current sampling point.
    • For a background thread, the value is the thread name, such as observer, and WrTimer.
    • For a foreground thread, the value depends on the type of the thread.
      • If the thread executes general requests, the value is in the user@client_ip (thread_name) format.
      • If the thread executes remote inner_sql requests, the value is in the INNER SQL REMOTE EXEC (thread_name) format.
      • If the thread executes remote DAS requests, the value is in the DAS REMOTE EXEC (thread_name) format.
    MODULE varchar(64) No The MODULE value recorded during session sampling.
    ACTION varchar(64) No The ACTION value recorded during session sampling. The field value is always NULL.
    CLIENT_ID varchar(64) No The CLIENT_ID value recorded during session sampling. The field value is always NULL.
    BACKTRACE varchar(512) No An auxiliary debugging field, which records the code call stack when an event occurs. The field value is always NULL.
    TM_DELTA_TIME bigint(20) No The time interval for calculating the time model, in μs.
    TM_DELTA_CPU_TIME bigint(20) No The amount of CPU time spent in the last interval indicated by the TM_DELTA_TIME field.
    TM_DELTA_DB_TIME bigint(20) No The amount of time spent in database calls in the last interval indicated by the TM_DELTA_TIME field.
    TOP_LEVEL_SQL_ID varchar(32) No The ID of the top-level SQL statement.
    IN_PLSQL_COMPILATION varchar(1) No The current status of PL compilation. Valid values: Y and N.
    IN_PLSQL_EXECUTION varchar(1) No The current status of PL execution. Valid values: Y and N.
    PLSQL_ENTRY_OBJECT_ID bigint(20) No The ID of the top-level PL object.
    PLSQL_ENTRY_SUBPROGRAM_ID bigint(20) No The ID of the top-level PL subprogram.
    PLSQL_ENTRY_SUBPROGRAM_NAME varchar(32) No The name of the top-level PL subprogram.
    PLSQL_OBJECT_ID bigint(20) No The ID of the PL object that is being executed.
    PLSQL_SUBPROGRAM_ID bigint(20) No The ID of the PL subprogram that is being executed.
    PLSQL_SUBPROGRAM_NAME varchar(32) No The name of the PL subprogram that is being executed.

    Example

    obclient [oceanbase]> SELECT * FROM oceanbase.V$OB_ACTIVE_SESSION_HISTORY limit 2;
    

    The query result is as follows:

    +----------------+----------+-----------+---------------------+--------+---------+--------------+--------------+---------------+--------+---------+-------------------------+-------+----------+----------+--------+------+--------+------+--------+------+------------+---------------+-------------+------------------+----------+-------------+---------------+-----------------+------------------+-----------------+------------------+---------------+-----------------+------------------+-------------------------+----------------+-------------+--------+--------+-----------+-----------+---------------+-------------------+------------------+------------------+----------------------+--------------------+-----------------------+---------------------------+-----------------------------+-----------------+---------------------+-----------------------+
    | SVR_IP         | SVR_PORT | SAMPLE_ID | SAMPLE_TIME         | CON_ID | USER_ID | SESSION_ID   | SESSION_TYPE | SESSION_STATE | SQL_ID | PLAN_ID | TRACE_ID                | EVENT | EVENT_NO | EVENT_ID | P1TEXT | P1   | P2TEXT | P2   | P3TEXT | P3   | WAIT_CLASS | WAIT_CLASS_ID | TIME_WAITED | SQL_PLAN_LINE_ID | 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 | 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 |
    +----------------+----------+-----------+---------------------+--------+---------+--------------+--------------+---------------+--------+---------+-------------------------+-------+----------+----------+--------+------+--------+------+--------+------+------------+---------------+-------------+------------------+----------+-------------+---------------+-----------------+------------------+-----------------+------------------+---------------+-----------------+------------------+-------------------------+----------------+-------------+--------+--------+-----------+-----------+---------------+-------------------+------------------+------------------+----------------------+--------------------+-----------------------+---------------------------+-----------------------------+-----------------+---------------------+-----------------------+
    | xx.xx.xx.xx |     2882 |   3906741 | 2024-01-03 10:26:12 |    500 |       0 | 141733920768 | BACKGROUND   | ON CPU        |        |       0 | Y0-0000000000000000-0-0 |       |        0 |     NULL |        |    0 |        |    0 |        |    0 | OTHER      |           100 |           0 |             NULL | N        | N           | N             | N               | N                | N               | N                | N             | N               | N                | N                       | N              | KVCacheWash | NULL   | NULL   | NULL      | NULL      |       3336060 |           3336060 |          3336060 | NULL             | N                    | N                  |                  NULL |                      NULL | NULL                        |            NULL |                NULL | NULL                  |
    | xx.xx.xx.xx |     2882 |   3906742 | 2024-01-03 10:26:12 |    500 |       0 |  34359738368 | BACKGROUND   | ON CPU        |        |       0 | Y0-0000000000000000-0-0 |       |        0 |     NULL |        |    0 |        |    0 |        |    0 | OTHER      |           100 |           0 |             NULL | N        | N           | N             | N               | N                | N               | N                | N             | N               | N                | N                       | N              | ConfigMgr   | NULL   | NULL   | NULL      | NULL      |       1007028 |           1004378 |          1007028 | NULL             | N                    | N                  |                  NULL |                      NULL | NULL                        |            NULL |                NULL | NULL                  |
    +----------------+----------+-----------+---------------------+--------+---------+--------------+--------------+---------------+--------+---------+-------------------------+-------+----------+----------+--------+------+--------+------+--------+------+------------+---------------+-------------+------------------+----------+-------------+---------------+-----------------+------------------+-----------------+------------------+---------------+-----------------+------------------+-------------------------+----------------+-------------+--------+--------+-----------+-----------+---------------+-------------------+------------------+------------------+----------------------+--------------------+-----------------------+---------------------------+-----------------------------+-----------------+---------------------+-----------------------+
    2 rows in set (0.137 sec)
    

    Previous topic

    GV$OB_ACTIVE_SESSION_HISTORY
    Last

    Next topic

    GV$OB_CGROUP_CONFIG
    Next
    What is on this page
    Purpose
    Columns
    Example