Note
This view is introduced since OceanBase Database V4.3.0.
Purpose
The GV$OB_SESSION view displays information about sessions created on all OBServer nodes.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| ID | bigint(20) unsigned | NO | For V4.3.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) | YES | 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) | YES | The current status of the session. |
| INFO | varchar(262143) | YES | 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 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 | YES | The session ID of ODP, if ODP is used for connection. |
| USER_CLIENT_IP | varchar(46) | YES | The IP address of the user client. |
| USER_HOST | varchar(128) | YES | The hostname 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) | YES | The trace ID. |
| REF_COUNT | bigint(20) | NO | The reference count of the connection. |
| BACKTRACE | varchar(16384) | YES | The call stack for connection references. |
| TRANS_STATE | varchar(32) | YES | 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 all OBServer nodes of all tenants.
obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_SESSION limit 1\G
The query result is as follows:
*************************** 1. row ***************************
ID: 3221536794
USER:
TENANT:
HOST: 0.0.0.0:0
DB: NULL
COMMAND: Sleep
SQL_ID:
TIME: 0
STATE: ACTIVE
INFO: NULL
SVR_IP: xx.xx.xx.xx
SVR_PORT: 2882
SQL_PORT: 2881
PROXY_SESSID: NULL
USER_CLIENT_IP: NULL
USER_HOST: NULL
TRANS_ID: 0
THREAD_ID: 0
TRACE_ID: NULL
REF_COUNT: 0
BACKTRACE:
TRANS_STATE:
USER_CLIENT_PORT: 0
TOTAL_CPU_TIME: 0