Note
This view is introduced in OceanBase Database V4.2.0.
Purpose
The GV$OB_LOCKS view shows the locks held or requested on each table by the current user.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| SVR_IP | VARCHAR2(46) | NO | The IP address of the OBServer node that holds or requests a lock. |
| SVR_PORT | NUMBER(38) | NO | The port number of the OBServer node that holds or requests a lock. |
| TENANT_ID | NUMBER(38) | NO | The ID of the tenant that holds or requests a lock. |
| TRANS_ID | NUMBER(38) | NO | The ID of the transaction that holds or requests a lock. |
| SESSION_ID | NUMBER(38) | NO | The ID of the session that holds or requests a lock.
|
| TYPE | VARCHAR2(9) | NO | The lock type:
|
| ID1 | bigint(20) | NO | Lock identifier 1:
|
| ID2 | bigint(20) | NO | Lock identifier 2:
|
| ID3 | varchar(512) | NO | Lock identifier 3:
Note
|
| LMODE | VARCHAR2(4) | NO | The lock mode currently held:
|
| REQUEST | VARCHAR2(8) | NO | The lock mode currently requested:
|
| CTIME | NUMBER(38) | NO | The time the lock is held or waited, in microseconds. |
| BLOCK | NUMBER | NO | Indicates whether the lock requested by the current transaction is held by other transactions:
|
Sample query
The following example shows the locks held or requested by the current user on all tables.
obclient [SYS]> SELECT * FROM SYS.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 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 500084 | X | NONE | 97318270 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200069 | X | NONE | 97301357 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200068 | X | NONE | 97301364 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200067 | X | NONE | 97301372 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200066 | X | NONE | 97301379 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200065 | X | NONE | 97301389 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200064 | X | NONE | 97301396 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200063 | X | NONE | 97301403 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200062 | X | NONE | 97301431 | 0 |
| 11.xxx.xxx.xxx | 28825 | 1004 | 3966849 | 3221605368 | TM | 3966849 | 3221605368 | 200061 | X | NONE | 97301442 | 0 |
+----------------+----------+-----------+----------+------------+------+---------+------------+--------+-------+---------+----------+-------+
10 rows in set
References
For more information about table locks, see Lock a table.