Overview
The V$OB_SESSION view is used to record information about sessions created in the current server.
Columns
Field |
Type |
Nullable |
Description |
|---|---|---|---|
| ID | bigint(20) unsigned | NO |
|
| USER | varchar(32) | NO | Represents the user to whom the session belongs. |
| TENANT | varchar(128) | NO | Tenant Name |
| HOST | varchar(128) | NO | Indicates the client IP address and port number that initiated the session. If connecting to the database via ODP, it indicates the host IP address and port number of ODP. |
| DB | varchar(128) | NO | Indicates the name of the database to which the session is currently connected. |
| COMMAND | varchar(4096) | NO | Indicates the command being executed by the session. |
| SQL_ID | varchar(32) | NO | SQL ID Information |
| TIME | bigint(21) | NO | Indicates the time taken to execute the current command, in seconds. If the command is retried, this value will be reset and recalculated. |
| STATE | varchar(128) | NO | Indicates the current state of the session. |
| INFO | varchar(262143) | NO | Represents the statement being executed by the session. |
| SVR_IP | varchar(46) | NO | Server IP Address |
| SVR_PORT | bigint(20) | NO | Server RPC Port Number |
| SQL_PORT | bigint(20) | NO | SQL port number of the server |
| PROXY_SESSID | bigint(20) unsigned | NO | If the current client is ODP, this column displays the ODP session ID. |
| USER_CLIENT_IP | varchar(46) | NO | User Client IP |
| USER_HOST | varchar(128) | NO | User Client Host Name |
| TRANS_ID | bigint(20) unsigned | NO | Transaction ID |
| THREAD_ID | bigint(20) unsigned | NO | Thread ID |
| TRACE_ID | varchar(64) | NO | Trace ID |
| REF_COUNT | bigint(20) | NO | Connection Reference Count |
| BACKTRACE | varchar(16384) | NO | Connection Reference Call Stack |
| TRANS_STATE | varchar(32) | NO | Transaction status. If no transaction is active in the session, this field is empty. Valid values:
|
| USER_CLIENT_PORT | bigint(20) | NO | User Client Port Number |
| TOTAL_CPU_TIME | bigint(21) | NO | The CPU time consumed by the current command, in seconds. |
Sample query
Query the session information created on 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