Note
This view is introduced in V4.2.0.
Purpose
The GV$OB_LOCKS view displays the lock or lock request information of each table for the current user.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| SVR_IP | varchar(46) | NO | The IP address of the OBServer node that holds or requests the lock. |
| SVR_PORT | bigint(20) | NO | The port number of the OBServer node that holds or requests the lock. |
| TENANT_ID | bigint(20) | NO | The ID of the tenant that holds or requests the lock. |
| TRANS_ID | bigint(20) | NO | The transaction ID of the transaction that holds or requests the lock. |
| SESSION_ID | bigint(20) | NO | The session ID of the session that holds or requests the lock.
|
| TYPE | varchar(9) | NO | The type of the lock. Valid values:
|
| ID1 | bigint(20) | NO | Identifier 1 of the lock. Valid values:
|
| ID2 | bigint(20) | NO | Identifier 2 of the lock. Valid values:
|
| ID3 | varchar(512) | NO | Identifier 3 of the lock. Valid values:
Note
|
| LMODE | varchar(4) | NO | The mode in which the current lock is held. Valid values:
|
| REQUEST | varchar(8) | NO | The mode in which the current lock is requested. Valid values:
|
| CTIME | bigint(20) | NO | The time when the lock was obtained or the wait time for the lock, in microseconds. |
| BLOCK | bigint(1) | NO | Whether the lock requested by the current transaction is held by another transaction. Valid values:
|
Sample query
Query the lock holding or lock request status for each table of the current user.
obclient [oceanbase]> SELECT * FROM oceanbase.V$OB_LOCKS LIMIT 1\G
The query result is as follows:
*************************** 1. row ***************************
SVR_IP: xx.xx.xx.xx
SVR_PORT: 2882
TENANT_ID: 1003
TRANS_ID: 7414198
SESSION_ID: 3221619563
TYPE: TX
ID1: 7414198
ID2: 3221619563
ID3: NULL
LMODE: X
REQUEST: NONE
CTIME: 11162
BLOCK: 0
References
For more information about table locks, see Lock a table.