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 V$OB_SESSION view displays the information about sessions created on the current OBServer node.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| ID | bigint(20) unsigned | NO | For V4.2.x:
|
| 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) | NO | 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) | NO | The status of the session. |
| INFO | varchar(262143) | NO | 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 | NO | The session ID of ODP, if ODP is used for the connection. |
| USER_CLIENT_IP | varchar(46) | NO | The IP address of the user client. |
| USER_HOST | varchar(128) | NO | 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) | NO | The ID of the trace. |
| REF_COUNT | bigint(20) | NO | The reference count of the connection. |
| BACKTRACE | varchar(16384) | NO | The call stack for connection references. |
| TRANS_STATE | varchar(32) | NO | 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 information about sessions created on the current OBServer node.
obclient [oceanbase]> SELECT * FROM oceanbase.V$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: 9A973D26DFBCAD31C82BB47571C2E6CD
TIME: 0
STATE: ACTIVE
INFO: SELECT * FROM oceanbase.V$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: 19054
TRACE_ID: YBXXXXXXXX-000XXXXXXXX-0-0
REF_COUNT: 0
BACKTRACE:
TRANS_STATE:
TOTAL_CPU_TIME: 0
1 row in set (0.005 sec)