{question}
How to determine if there are database locks in the current running transaction and if so which transaction ID is it?
{question}
{answer}The following query result indicates whether there is a lock or not:
The following query result indicates whether there is a lock or not:
In case there is at least one lock, the result includes the transaction ID (BLOCKEDBY ), for example:
SQL> select * from system.transactions where blockedby <> -1; ID STATE NODEID BLOCKEDBY STARTEVENT ENDEVENT SEQUENCE ISOLATIONLEVEL ISUPDATE DEADLOCKVICTIM COMMITPROTOCOL QUEUE SOURCENODE
------------ ------ ------- ------------ ----------- --------- --------- --------------- --------- --------------- --------------- ------ ----------- 106531156226 Active 2 106532232324 1483 <null> -1 8 TRUE FALSE local Active 4
106531156226 Active 2 106532232324 1511 <null> -1 8 TRUE FALSE local Active 2
More information and examples can be found here.
{answer}
Comments