Overview
The GV$OB_SESSION view is used to record session information created on all servers.
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) | YES | 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) | YES | Indicates the current state of the session. |
| INFO | varchar(262143) | YES | 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 | YES | If the current client is ODP, this column displays the ODP session ID. |
| USER_CLIENT_IP | varchar(46) | YES | User Client IP |
| USER_HOST | varchar(128) | YES | User Client Host Name |
| TRANS_ID | bigint(20) unsigned | NO | Transaction ID |
| THREAD_ID | bigint(20) unsigned | NO | Thread ID |
| TRACE_ID | varchar(64) | YES | Trace ID |
| REF_COUNT | bigint(20) | NO | Connection Reference Count |
| BACKTRACE | varchar(16384) | YES | Connection Reference Call Stack |
| TRANS_STATE | varchar(32) | YES | Transaction status. If no transaction exists 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 all servers.
obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_SESSION limit 1\G
The query result is as follows:
*************************** 1. row ***************************
ID: 3221537799
USER: root
TENANT: mysql001
HOST: 100.xx.xxx.xxx:62434
DB: oceanbase
COMMAND: Query
SQL_ID: 9A973D26DFBCAD31C82BB47571C2E6CD
TIME: 0
STATE: ACTIVE
INFO: SELECT * FROM oceanbase.V$OB_SESSION limit 1
SVR_IP: 172.xx.xxx.xxx
SVR_PORT: 2882
SQL_PORT: 2881
PROXY_SESSID: NULL
USER_CLIENT_IP: 100.xx.xxx.xxx
USER_HOST: %
TRANS_ID: 0
THREAD_ID: 109604
TRACE_ID: YB4xxxxxxxxx-xxxxxxxxxx-0-0
REF_COUNT: 0
BACKTRACE:
TRANS_STATE:
USER_CLIENT_PORT: 62434
TOTAL_CPU_TIME: 0
1 row in set