Note
This view is available starting with V4.3.0.
Purpose
The V$OB_SESSION view records session information created in the current server.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| ID | bigint(20) unsigned | NO | For V4.3.x versions:
|
| USER | varchar(32) | NO | Indicates the user to which the session belongs. |
| TENANT | varchar(128) | NO | Indicates the name of the tenant to which the session belongs. |
| HOST | varchar(128) | NO | Indicates the IP address and port number of the client that initiated the session. If the database is connected through ODP, this column indicates the IP address and port number of the ODP. |
| DB | varchar(128) | NO | Indicates the name of the database to which the session is connected. |
| COMMAND | varchar(4096) | NO | Indicates the command being executed by the session. |
| SQL_ID | varchar(32) | NO | Indicates the SQL ID. |
| TIME | bigint(21) | NO | Indicates the time taken to execute the current command, in seconds. If the command is retried, this column is reset to 0. |
| STATE | varchar(128) | NO | Indicates the current state of the session. |
| INFO | varchar(262143) | NO | Indicates the statement being executed by the session. |
| SVR_IP | varchar(46) | NO | Indicates the IP address of the server. |
| SVR_PORT | bigint(20) | NO | Indicates the RPC port number of the server. |
| SQL_PORT | bigint(20) | NO | Indicates the SQL port number of the server. |
| PROXY_SESSID | bigint(20) unsigned | NO | If the client is ODP, this column indicates the session ID of ODP. |
| USER_CLIENT_IP | varchar(46) | NO | Indicates the IP address of the user client. |
| USER_HOST | varchar(128) | NO | Indicates the host name of the user client. |
| TRANS_ID | bigint(20) unsigned | NO | Indicates the transaction ID. |
| THREAD_ID | bigint(20) unsigned | NO | Indicates the thread ID. |
| TRACE_ID | varchar(64) | NO | Indicates the trace ID. |
| REF_COUNT | bigint(20) | NO | Indicates the connection reference count. |
| BACKTRACE | varchar(16384) | NO | Indicates the call stack of the connection reference. |
| TRANS_STATE | varchar(32) | NO | Indicates the transaction state. If no transaction exists on the session, this column is empty.
|
| USER_CLIENT_PORT | bigint(20) | NO | Indicates the port number of the user client.
NoteFor V4.4.x versions, this column is available starting with V4.4.0. |
| TOTAL_CPU_TIME | bigint(21) | NO | Indicates the CPU time consumed to execute the current command, in seconds |
Sample query
Query session information created in the current server.
obclient [oceanbase]> SELECT * FROM oceanbase.V$OB_SESSION limit 1\G
The query result is as follows:
*************************** 1. row ***************************
ID: 3221667264
USER: root
TENANT: mysql001
HOST: xx.xx.xx.xx:26677
DB: test
COMMAND: Sleep
SQL_ID:
TIME: 585
STATE: SLEEP
INFO: NULL
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: 0
TRACE_ID: NULL
REF_COUNT: 0
BACKTRACE:
TRANS_STATE:
USER_CLIENT_PORT: 26677
TOTAL_CPU_TIME: 0