Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Deadlocking in Oracle
I am running into a deadlock situation and would like to get some suggestions on how to avoid it. I am using OCI to do the following
Starting OCI transacation (implicit)
//Execute the following sql through OCI
Delete MyTable where id="123"; // Delete multiplr rows
if delete fails OCITransRollback;
Insert INTO MyTable (id, name, val) VALUES ('123', 'n1', 'v1')
if insert fails OCITransRollback;
Insert INTO MyTable (id, name, val) VALUES ('123', 'n2', 'v2')
if insert fails OCITransRollback;
Insert INTO MyTable (id, name, val) VALUES ('123', 'n3', 'v3')
if insert fails OCITransRollback;
else OCITransCommit;
Under heavy load above pesdu methods causes deadlock. Note it is possible that multiple clients are using the same id to insert and delet rows. I have checked to make sure I rollback in case of all failures and commit in case of success.
Sanjay Received on Wed Aug 01 2001 - 10:00:17 CDT