Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Oracle locking strategy: how does it work
I'm currently running into some deadlock problems, and although oracle
seems to
be able to recover from deadlocks, this is not *always* the case. (I
will discuss this specific problem later) The point is that deadlocks
seem to occur on moments that I do not expect oracle to lock something.
Example:
delete from t1 where t1.id in (select id from t2 where t2.something='value');
At the moment this query gave a deadlock on me, table t2 WAS EMPTY!
(and t1.id has a primary key on it)
So the question is:
- Is the information in the server log about these deadlocks reliable?
- Is oracle locking in a different way than I was assuming it was? My
assumption is that if a delete statement does not delete rows, it will
not lock any.
Some documentation says that you can always get deadlocks from oracle,
even for no reason. But the oracle dump just says 'due to incorrect
application design' (which pisses me off) Is this true? or should I
alter my code until all deadlocks are away?
(I'm using oracle 7.3.2.3)
About oracle's deadlock-recovery, I use the following piece of code,
which is used
inside a background process that executes plsql statements on the
background:
ORA .. no statement parsed
(this happend about 50 times after the deadlock, and no statement was
executed without this error)
Closing the session and restarting it solved the problem.
any suggestions?
--Received on Sun Jan 18 1998 - 00:00:00 CST