Oracle database is hanging infinitly in UPDATE queries

前端 未结 2 1509
时光说笑
时光说笑 2020-12-08 17:12

suddenly my update queries are not executing . i can make select queries but when i try to update records the database hangs infinitly. i

相关标签:
2条回答
  • 2020-12-08 17:41

    Most likely you have another open uncommitted transaction for the same set of records, so they are locked for that transaction.

    And, most likely, you locked them, running the same UPDATE in another transaction.

    Just Commit/rollback your transactions, you should be fine.

    0 讨论(0)
  • 2020-12-08 17:45

    This query will show you who is blocking your update. Execute the update that hangs, then in another session run this:

    select s1.username || '@' || s1.machine ||
      ' ( SID=' || s1.sid || ' )  is blocking '
      || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
      from v$lock l1 join v$lock l2 on (l1.id1 = l2.id1 and l2.id2 = l2.id2) 
                     JOIN v$session s1 ON (s1.sid = l1.sid)
                     JOIN v$session s2 ON (s2.sid = l2.sid)
      WHERE l1.BLOCK=1 and l2.request > 0;
    

    EDIT:

    To properly attribute this, it looks like I cribbed this a while back from ORAFAQ.

    0 讨论(0)
提交回复
热议问题