snippetMinor
How to troubleshoot enq: TX - row lock contention?
Viewed 0 times
contentiontroubleshoothowenqrowlock
Problem
I have the following situation.
I have RAC. On both nodes there are the locks.
On the First Node
Blocking session info
On the Second Node
Blocking session info
Additional Info : Blocking session SQL_TEXT
```
create or replace procedure ACTIONProcedureDELETE
(
p_ID NUMBER
)
is
cursor oldval is select r.id,r.sessionstatus
from MyTABLEIMAGES r where r.idparent=p_ID;
begin
update actionmyTableblock r set r.status='False' where ID=p_ID;
for oldvalItem in oldval loop
if oldvalItem.Sessionstatus='True' then
update MyTABLEIMAGES r set r.sessionstatus='False' where r.id=oldvalItem.Id;
else
update MyTABLEIMAGES r set r.sessionstatus='True' where r.id=oldvalItem.Id;
I have RAC. On both nodes there are the locks.
On the First Node
SID EVENT USERNAME BLOCKING_SESSION ROW_WAIT_OBJ# OBJECT_NAME LOCKWAIT SQL_ID STATUS
1 102 enq: TX - row lock contention MYUSER 155 136972 TABLE1V 0000000810EFA958 5f4bzdg49fdxq ACTIVE
2 111 enq: TX - row lock contention MYUSER 155 136972 TABLE1V 0000000810EFAC98 5f4bzdg49fdxq ACTIVEBlocking session info
SID EVENT USERNAME ROW_WAIT_OBJ# OBJECT_NAME LOCKWAIT SQL_ID STATUS
1 155 SQL*Net message from client MYUSER 136971 MyTABLEIMAGES_IDPK 4hw85z8absbjc INACTIVEOn the Second Node
SID EVENT USERNAME BLOCKING_SESSION ROW_WAIT_OBJ# OBJECT_NAME LOCKWAIT SQL_ID STATUS
1 65 enq: TX - row lock contention MYUSER 155 137033 FactTABLE1V 0000000810EF9B58 1mznc2z75ksdx ACTIVE
2 111 enq: TX - row lock contention MYUSER 155 136972 TABLE1V 0000000810EF9818 5f4bzdg49fdxq ACTIVEBlocking session info
SID EVENT USERNAME ROW_WAIT_OBJ# OBJECT_NAME SQL_ID STATUS
1 155 SQL*Net message from client MYUSER 127176 MYTableLOG INACTIVEAdditional Info : Blocking session SQL_TEXT
```
create or replace procedure ACTIONProcedureDELETE
(
p_ID NUMBER
)
is
cursor oldval is select r.id,r.sessionstatus
from MyTABLEIMAGES r where r.idparent=p_ID;
begin
update actionmyTableblock r set r.status='False' where ID=p_ID;
for oldvalItem in oldval loop
if oldvalItem.Sessionstatus='True' then
update MyTABLEIMAGES r set r.sessionstatus='False' where r.id=oldvalItem.Id;
else
update MyTABLEIMAGES r set r.sessionstatus='True' where r.id=oldvalItem.Id;
Solution
Query
v$transaction on each node to see uncommitted sessions:SELECT t.start_time, s.sid, s.serial#, s.username, s.status,s.schemaname, s.osuser
, s.process, s.machine, s.terminal, s.program, s.module
, to_char(s.logon_time,'DD/MON/YY HH24:MI:SS') logon_time
FROM v$transaction t, v$session s
WHERE s.saddr = t.ses_addr
ORDER BY start_time;Code Snippets
SELECT t.start_time, s.sid, s.serial#, s.username, s.status,s.schemaname, s.osuser
, s.process, s.machine, s.terminal, s.program, s.module
, to_char(s.logon_time,'DD/MON/YY HH24:MI:SS') logon_time
FROM v$transaction t, v$session s
WHERE s.saddr = t.ses_addr
ORDER BY start_time;Context
StackExchange Database Administrators Q#18569, answer score: 7
Revisions (0)
No revisions yet.