Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: deadlocks between single update statements ?

Re: deadlocks between single update statements ?

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sat, 23 Sep 2006 10:23:45 +0100
Message-ID: <Brydnbf1qYYGYInYRVnyrA@bt.com>


<hasta_l3_at_hotmail.com> wrote in message news:1159000862.384129.73710_at_i3g2000cwc.googlegroups.com...
> Dear group,
>
> Assume a transaction A with a single update statement updating many
> rows of a table.
> Assume another transaction B also with a single update, concurrently
> updating the same rows, but perhaps in a different order.
>
> Can these single updates deadlock ?
>

        If the row updates are in exactly the same
        order, the second transaction will wait for
        the first transaction to commit or rollback.

        If the row updates are in a different order
        you will get a deadlock.

> How do you prevent this ?
>

  1. Serialize the two updates
  2. Program for deadlock detection so that you can rollback and retry.

> Thanks much.
>

-- 
Regards

Jonathan Lewis
http://www.oracle.com/technology/community/oracle_ace/ace1.html#lewis

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html

Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html
Received on Sat Sep 23 2006 - 04:23:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US