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

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

    V$ACTIVE_SESSION_HISTORY

    Last Updated:2024-04-19 08:42:49  Updated
    share
    What is on this page
    Purpose
    Columns
    Sample query
    References

    folded

    share

    Note

    This view is introduced since OceanBase Database V4.0.0.

    Purpose

    The V$ACTIVE_SESSION_HISTORY view displays the active session history.

    Columns

    Column Type Nullable? Description
    SVR_IP VARCHAR2(46) NO The IP address of the server to which the sample belongs.
    SVR_PORT NUMBER NO The port number of the server to which the sample belongs.
    SAMPLE_ID NUMBER NO The unique ID of the sample.
    SAMPLE_TIME TIMESTAMP(6) NO The sampling time.
    CON_ID NUMBER NO The ID of the tenant.
    USER_ID NUMBER NO The ID of the user whose session is sampled.
    SESSION_ID NUMBER NO The ID of the sampled session.
    SESSION_TYPE VARCHAR2(10) NO The session type. Valid values:
  • FOREGROUND: foreground session, that is, user session.
  • BACKGROUND: background session, which is not supported for now.
  • SESSION_STATE VARCHAR2(7) NO The session status. Valid values:
  • ON CPU: The SQL logic is being executed without waiting.
  • WAITING: The session is waiting. For more information, see the EVENT column.
  • SQL_ID VARCHAR2(32) NO The SQL ID.
    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 VARCHAR2(64) NO The trace ID of the operator.
    EVENT VARCHAR2(64) NO The description of the wait event.
    EVENT_NO NUMBER NO The internal number of the wait event, which is used for join query with other tables.
    P1TEXT VARCHAR2(64) NO The name of the first parameter of the wait event. The parameter name varies with the event.
    P1 NUMBER NO The value of the first parameter of the wait event.
    P2TEXT VARCHAR2(64) NO The name of the second parameter of the wait event. The parameter name varies with the event.
    P2 NUMBER NO The value of the second parameter of the wait event.
    P3TEXT VARCHAR2(64) NO The name of the third parameter of the wait event. The parameter name varies with the event.
    P3 NUMBER NO The value of the third parameter of the wait event.
    WAIT_CLASS VARCHAR2(64) NO The class of the wait event.
    WAIT_CLASS_ID NUMBER NO The ID of the class of the wait event, which is used for join query with other tables.
    TIME_WAITED NUMBER NO The total wait time of the wait event. Unit: us.
    SQL_PLAN_LINE_ID NUMBER NO The ID of the SQL operator in the SQL plan when the session is being sampled.
    IN_PARSE VARCHAR2(1) NO Indicates whether the session is parsing an SQL statement during sampling.
    IN_PL_PARSE VARCHAR2(1) NO Indicates whether the session is parsing an SQL PL statement during sampling.
    IN_PLAN_CACHE VARCHAR2(1) NO Indicates whether the session is matching a plan cache during sampling.
    IN_SQL_OPTIMIZE VARCHAR2(1) NO Indicates whether the session is optimizing SQL parsing during sampling.
    IN_SQL_EXECUTION VARCHAR2(1) NO Indicates whether the session is executing an SQL statement during sampling.
    IN_PX_EXECUTION VARCHAR2(1) NO Indicates whether the session is executing SQL statements in parallel during sampling. If the session is in this state, it must also be in the state of SQL statement executing.
    IN_SEQUENCE_LOAD VARCHAR2(1) NO Indicates whether the session is generating values for an auto-increment column or a sequence during sampling.
    IN_COMMITTING VARCHAR2(1) NO Indicates whether the current sampling point is in the transaction commit phase.

    Note

    This column is introduced since OceanBase Database V4.2.1.

    IN_STORAGE_READ VARCHAR2(1) NO Indicates whether the current sampling point is in the storage read phase.

    Note

    This column is introduced since OceanBase Database V4.2.1.

    IN_STORAGE_WRITE VARCHAR2(1) NO Indicates whether the current sampling point is in the storage write phase.

    Note

    This column is introduced since OceanBase Database V4.2.1.

    IN_REMOTE_DAS_EXECUTION VARCHAR2(1) NO Indicates whether the current sampling point is in the remote execution phase of direct-attached storage (DAS).

    Note

    This column is introduced since OceanBase Database V4.2.1.

    MODULE VARCHAR2(64) NO The MODULE value recorded during session sampling. The value is always NULL.
    ACTION VARCHAR2(64) NO The ACTION value recorded during session sampling. The value is always NULL.
    CLIENT_ID VARCHAR2(64) NO The CLIENT_ID value recorded during session sampling. The value is always NULL.
    BACKTRACE VARCHAR2(512) NO An auxiliary debugging column, which records the code call stack when an event occurs. The value is always NULL.
    TM_DELTA_TIME NUMBER NO The time interval for calculating the time model, in μs.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    TM_DELTA_CPU_TIME NUMBER NO The amount of CPU time spent in the last interval indicated by the TM_DELTA_TIME column.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    TM_DELTA_DB_TIME NUMBER NO The amount of time spent in database calls in the last interval indicated by the TM_DELTA_TIME column.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    TOP_LEVEL_SQL_ID CHAR(32) NO The ID of the top-level SQL statement.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    IN_PLSQL_COMPILATION VARCHAR2(1) NO The current status of PL compilation. Valid values: Y and N.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    IN_PLSQL_EXECUTION VARCHAR2(1) NO The current status of PL execution. Valid values: Y and N.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    PLSQL_ENTRY_OBJECT_ID NUMBER NO The ID of the top-level PL object.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    PLSQL_ENTRY_SUBPROGRAM_ID NUMBER NO The ID of the top-level PL subprogram.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    PLSQL_ENTRY_SUBPROGRAM_NAME VARCHAR2(32) NO The name of the top-level PL subprogram.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    PLSQL_OBJECT_ID NUMBER NO The ID of the PL object that is being executed.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    PLSQL_SUBPROGRAM_ID NUMBER NO The ID of the PL subprogram that is being executed.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    PLSQL_SUBPROGRAM_NAME VARCHAR2(32) NO The name of the PL subprogram that is being executed.

    Note

    This column is introduced since OceanBase Database V4.2.2.

    Sample query

    obclient [SYS]> SELECT * FROM SYS.V$ACTIVE_SESSION_HISTORY WHERE ROWNUM <= 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 |   4099661 | 03-JAN-24 05.07.19.954302 PM |   1004 |       0 | 5098126180352 | BACKGROUND   | WAITING       | NULL   |       0 | Y0-0000000000000000-0-0 | exec inner sql wait     |       69 |    30000 | wait inner sql class |           30001 | inner session id | 3221735589 | NULL   |    0 | OTHER       |           100 |       11129 |             NULL | N        | N           | N             | N               | N                | N               | N                | N             | N               | N                | N                       | N              | T1004_TenantWea | MODULE (TX_UPDATE_WEAK_READ_VERSION) | NULL   | NULL      | NULL      |       2045936 |           1538217 |          2045936 | NULL             | N                    | N                  |                  NULL |                      NULL | NULL                        |            NULL |                NULL | NULL                  |
    | xx.xx.xx.xx |     2882 |   4099646 | 03-JAN-24 05.07.18.948799 PM |   1004 |       0 | 4943507357696 | BACKGROUND   | WAITING       | NULL   |       0 | Y0-0000000000000000-0-0 | latch: config lock wait |       91 |       40 | address              | 140638541330368 | number           | 1073743313 | tries  |    1 | CONCURRENCY |           104 |       10514 |                1 | N        | N           | N             | N               | N                | N               | N                | N             | N               | Y                | N                       | N              | T1004_ReqMemEvi | NULL                                 | NULL   | NULL      | NULL      |       2331130 |            133742 |          2331130 | NULL             | N                    | N                  |                  NULL |                      NULL | NULL                        |            NULL |                NULL | NULL                  |
    +----------------+----------+-----------+------------------------------+--------+---------+---------------+--------------+---------------+--------+---------+-------------------------+-------------------------+----------+----------+----------------------+-----------------+------------------+------------+--------+------+-------------+---------------+-------------+------------------+----------+-------------+---------------+-----------------+------------------+-----------------+------------------+---------------+-----------------+------------------+-------------------------+----------------+-----------------+--------------------------------------+--------+-----------+-----------+---------------+-------------------+------------------+------------------+----------------------+--------------------+-----------------------+---------------------------+-----------------------------+-----------------+---------------------+-----------------------+
    2 rows in set (0.079 sec)
    

    References

    • GV$OB_ACTIVE_SESSION_HISTORY
    • V$OB_ACTIVE_SESSION_HISTORY

    Previous topic

    GV$ACTIVE_SESSION_HISTORY
    Last

    Next topic

    GV$DML_STATS
    Next
    What is on this page
    Purpose
    Columns
    Sample query
    References