Note
This view is available starting with V4.2.0.
Purpose
This view displays the locks held or requested by the current user on all tables of the current OBServer node.
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 | The first lock identifier.
|
| ID2 | varchar(533) | NO | The second lock identifier.
|
| ID3 | varchar(512) | NO | The third lock identifier.
Note
|
| LMODE | varchar(8) | NO | The mode in which the lock is held.
|
| REQUEST | varchar(8) | NO | The mode in which the lock is requested.
|
| CTIME | bigint(20) | NO | The time for which the lock is held or for which the lock is being waited for, 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 held or requested by the current user on all tables of the current OBServer node.
obclient [oceanbase]> SELECT * FROM oceanbase.V$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 | 3770799 | 3221509936 | TM | 3770297 | 4294967295 | NULL | NONE | N | 2302737 | 1 |
+----------------+----------+-----------+----------+------------+------+---------+------------+------+-------+---------+---------+-------+
1 row in set
References
For more information about how to lock a table, see Lock a table.
