Note
This view is available starting with V4.2.0.
Purpose
This view displays the lock status of tables 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 that holds or requests the lock. |
| SESSION_ID | bigint(20) | NO | The session ID 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(8) | 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 time 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 lock status of tables for the current user on 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 | 1 | 9720694 | 3221516966 | TM | 9720177 | 4294967295 | NULL | NONE | N | 3120758 | 1 |
+----------------+----------+-----------+----------+------------+------+---------+------------+------+-------+---------+---------+-------+
1 row in set
References
For more information about table locks, see Lock a table (MySQL mode) and Lock a table (Oracle mode).