Note
This view is available starting with V4.2.0.
Purpose
This view displays the locks or lock requests of tables for the current user on all OBServer nodes.
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 ID of the transaction that holds or requests the lock. |
| SESSION_ID | bigint(20) | NO | The ID of the session that holds or requests the lock.
|
| TYPE | varchar(9) | NO | The lock type:
|
| ID1 | bigint(20) | NO | Lock identifier 1:
|
| ID2 | varchar(533) | NO | Lock identifier 2:
|
| ID3 | varchar(512) | NO | Lock identifier 3:
Note
|
| LMODE | varchar(4) | NO | The mode of the lock currently held:
|
| REQUEST | varchar(8) | NO | The mode of the lock currently requested:
|
| CTIME | bigint(20) | NO | The time for which the lock is held or the lock is waiting, in microseconds. |
| BLOCK | bigint(1) | NO | Indicates whether the lock requested by the current transaction is held by another transaction:
|
Sample query
Query the locks or lock requests of tables for the current user on all OBServer nodes.
obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_LOCKS;
The query result is as follows:
+----------------+----------+-----------+----------+------------+------+---------+------------+------+-------+---------+---------+-------+
| SVR_IP | SVR_PORT | TENANT_ID | TRANS_ID | SESSION_ID | TYPE | ID1 | ID2 | ID3 | LMODE | REQUEST | CTIME | BLOCK |
+----------------+----------+-----------+----------+------------+------+---------+------------+------+-------+---------+---------+-------+
| 11.xxx.xxx.xxx | 28825 | 1002 | 3771300 | 3221509936 | TM | 3770297 | 4294967295 | NULL | NONE | N | 4411886 | 1 |
+----------------+----------+-----------+----------+------------+------+---------+------------+------+-------+---------+---------+-------+
1 row in set
References
For more information about table locks, see Lock a table.