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