ORA-00060: deadlock detected while waiting for resource

wowrt picture wowrt · Jun 19, 2010 · Viewed 111k times · Source

I have a series of scripts running in parallel as a nohup on an AIX server hosting oracle 10g. These scripts are written by somebody else and are meant to be executed concurrently. All the scripts are performing updates on a table. I am getting the error,

ORA-00060: deadlock detected while waiting for resource

As I googled for this, I found, http://www.dba-oracle.com/t_deadly_perpetual_embrace_locks.htm

Even though the scripts are performing updation on the same table concurrently, they are performing updates on different records of the table determined by the WHERE clause with no overlaps of records between them.

So would this have caused the error?.

Will this error happen regardless of where the updates are performed on a table?.

Should I avoid concurrent updates on a table at all times?.

Strangely I also found on the nohup.out log, PL/SQL successfully completed after the above quoted error.

Does this mean that oracle has recovered from the deadlock and completed the updates successfully or Should I rerun those scripts serially? Any help would be welcome.

Thanks in advance.

Answer

benvolioT picture benvolioT · Oct 25, 2010

I was recently struggling with a similar problem. It turned out that the database was missing indexes on foreign keys. That caused Oracle to lock many more records than required which quickly led to a deadlock during high concurrency.

Here is an excellent article with lots of good detail, suggestions, and details about how to fix a deadlock: http://www.oratechinfo.co.uk/deadlocks.html#unindex_fk