Note
This view is introduced since OceanBase Database V4.3.0.
Purpose
The V$OB_SESSION view displays information about sessions created on the current OBServer node.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| ID | NUMBER(38) | NO | For V4.3.x:
|
| USER | CHAR(193) | NO | The user to which the session belongs. |
| TENANT | VARCHAR2(128) | NO | The name of the tenant accessed. |
| HOST | VARCHAR2(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 | VARCHAR2(128) | YES | The name of the database to which the session connects. |
| COMMAND | VARCHAR2(4096) | NO | The type of the statement being executed in the session. |
| SQL_ID | VARCHAR2(32) | NO | The ID of the SQL statement. |
| TIME | NUMBER(38) | NO | The execution time of the current statement, in seconds. If a retry occurs, the value is cleared and recalculated. |
| STATE | VARCHAR2(128) | YES | The current status of the session. |
| INFO | VARCHAR2(262143) | YES | The statement being executed in the session. |
| SVR_IP | VARCHAR2(46) | NO | The IP address of the OBServer node. |
| SVR_PORT | NUMBER(38) | NO | The RPC port number of the OBServer node. |
| SQL_PORT | NUMBER(38) | NO | The SQL port number of the OBServer node. |
| PROXY_SESSID | NUMBER(38) | YES | The session ID of ODP, if ODP is used for connection. |
| USER_CLIENT_IP | VARCHAR2(46) | YES | The IP address of the user client. |
| USER_HOST | VARCHAR2(128) | YES | The hostname of the user client. |
| TRANS_ID | NUMBER(38) | NO | The ID of the transaction. |
| THREAD_ID | NUMBER(38) | NO | The ID of the thread. |
| TRACE_ID | VARCHAR2(64) | YES | The trace ID. |
| REF_COUNT | NUMBER(38) | NO | The reference count of the connection. |
| BACKTRACE | VARCHAR2(16384) | YES | The call stack for connection references. |
| TRANS_STATE | VARCHAR2(32) | YES | The status of the transaction. |
| TOTAL_CPU_TIME | NUMBER(38) | NO | The CPU time spent on executing the current statement, in seconds. |
Sample query
Query information about sessions created on the current OBServer node.
obclient [SYS]> SELECT * FROM SYS.V$OB_SESSION WHERE ROWNUM <= 1\G
The query result is as follows:
*************************** 1. row ***************************
ID: 3221487694
USER: SYS
TENANT: oracle001
HOST: xx.xx.xx.xx:46156
DB: SYS
COMMAND: Query
SQL_ID: EEB077450268C07286E668791886DBA2
TIME: 0
STATE: ACTIVE
INFO: SELECT * FROM SYS.V$OB_SESSION WHERE ROWNUM <= 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: 20625
TRACE_ID: YXXXXXXXXXXX-000XXXXXXXXXXX-0-0
REF_COUNT: 0
BACKTRACE: NULL
TRANS_STATE: NULL
TOTAL_CPU_TIME: 0
1 row in set (0.004 sec)