GV$OB_SESSION

2025-12-04 07:10:03  Updated

Note

  • For OceanBase Database V4.3.x, this view was introduced in OceanBase Database V4.3.0.
  • For OceanBase Database V4.2.x, this view was introduced in OceanBase Database V4.2.5.

Purpose

The GV$OB_SESSION view displays the information about sessions created on all OBServer nodes.

Columns

Column Type Nullable? Description
ID bigint(20) unsigned NO For V4.2.x:
  • V4.2.5 BP4 and earlier:
    In both direct connect mode and ODP mode, this field indicates the Server Session ID.
  • V4.2.5 BP4 and later:
    • In direct connect mode:
      This field indicates the Server Session ID.
    • In ODP mode:
      • When client_session_id_version = 2 is configured for ODP, this field indicates the Client Session ID.
      • When client_session_id_version = 1, this field indicates the Server Session ID.
USER varchar(32) NO The user to which the session belongs.
TENANT varchar(128) NO The name of the tenant accessed.
HOST varchar(128) NO The IP address and port number of the client that initiated the session. If OceanBase Database Proxy (ODP) was used to connect to the database, the value indicates the host IP address and port number of ODP.
DB varchar(128) YES The name of the database to which the session connects.
COMMAND varchar(4096) NO The type of the statement being executed in the session.
SQL_ID varchar(32) NO The ID of the SQL statement.
TIME bigint(21) NO The execution time of the current statement, in seconds. If a retry occurs, the value is cleared and recalculated.
STATE varchar(128) YES The status of the session.
INFO varchar(262143) YES The statement being executed in the session.
SVR_IP varchar(46) NO The IP address of the OBServer node.
SVR_PORT bigint(20) NO The remote procedure call (RPC) port number of the OBServer node.
SQL_PORT bigint(20) NO The SQL port number of the OBServer node.
PROXY_SESSID bigint(20) unsigned YES The session ID of ODP, if ODP is used for the connection.
USER_CLIENT_IP varchar(46) YES The IP address of the user client.
USER_HOST varchar(128) YES The host name of the user client.
TRANS_ID bigint(20) unsigned NO The ID of the transaction.
THREAD_ID bigint(20) unsigned NO The ID of the thread.
TRACE_ID varchar(64) YES The ID of the trace.
REF_COUNT bigint(20) NO The reference count of the connection.
BACKTRACE varchar(16384) YES The call stack for connection references.
TRANS_STATE varchar(32) YES The status of the transaction.
TOTAL_CPU_TIME bigint(21) NO The CPU time spent on executing the current statement, in seconds.

Sample query

Query the information about sessions created on all OBServer nodes.

obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_SESSION limit 1\G

The query result is as follows:

*************************** 1. row ***************************
            ID: 3221747702
          USER: root
        TENANT: mysql001
          HOST: xx.xx.xx.xx:55573
            DB: NULL
       COMMAND: Query
        SQL_ID: 802A391F73FB7B28ABEA6757DACFE1EC
          TIME: 0
         STATE: ACTIVE
          INFO: SELECT * FROM oceanbase.GV$OB_SESSION limit 1
        SVR_IP: xx.xx.xx.xx
      SVR_PORT: 2882
      SQL_PORT: 2881
  PROXY_SESSID: NULL
USER_CLIENT_IP: xx.xx.xx.xx
     USER_HOST: %
      TRANS_ID: 0
     THREAD_ID: 17879
      TRACE_ID: YBXXXXXXXXX-000XXXXXXXXX-0-0
     REF_COUNT: 0
     BACKTRACE:
   TRANS_STATE:
TOTAL_CPU_TIME: 0
1 row in set (0.042 sec)

References

V$OB_SESSION

Contact Us