How to troubleshoot ORA-02049 and lock problems in general with Oracle

前端 未结 5 1342
伪装坚强ぢ
伪装坚强ぢ 2020-12-31 03:39

I am getting ORA-02049 occasionally for some long-running and/or intensive transactions. There is seemingly no pattern to this, but it happens on a simple INSERT.

I

5条回答
  •  失恋的感觉
    2020-12-31 04:14

    One possible way might be to increase the INIT.ORA parameter for distributed_lock_timeout to a larger value. This would then give you a longer time to observe the v$lock table as the locks would last for longer.

    To achieve automation of this, you can either

    • Run an SQL job every 5-10 seconds that logs the values of v$lock or the query that sandos has given above into a table and then analyze it to see which session was causing the lock.

    • Run a STATSPACK or an AWR Report. The sessions that got locked should show up with high elapsed time and hence can be identified.

    v$session has 3 more columns blocking_instance, blocking_session, blocking_session_status that can be added to the query above to give a picture of what is getting locked.

提交回复
热议问题