這種死鎖怎麼理解

imlihj2007發表於2009-12-31

DEADLOCK DETECTED ( ORA-00060 )
The following deadlock is not an ORACLE error. It is a
deadlock due to user error in the design of an application
or from issuing incorrect ad-hoc SQL. The following
information may aid in determining the deadlock:
Deadlock graph:
---------Blocker(s)-------- ---------Waiter(s)---------
Resource Name process session holds waits process session holds waits
TX-00040028-00e34df1 61 130 X 116 82 X
TX-00030016-011b29e6 116 82 X 61 130 X
session 130: DID 0001-003D-0004D93A session 82: DID 0001-0074-0000F535
session 82: DID 0001-0074-0000F535 session 130: DID 0001-003D-0004D93A

Rows waited on:
Session 82: obj - rowid = 000129AA - AAATO8AALAAAsshAAG
(dictionary objn - 76202, file - 11, block - 183073, slot - 6)
Session 130: obj - rowid = 00012967 - AAATO1AAIAAAU3rAAI
(dictionary objn - 76135, file - 8, block - 85483, slot - 8)

補充:

這種死鎖是由於兩個會話等待對方的資源,個分兩次呼叫,就會出現這個問題;

session 1

begin

update lock1 set num=3 where num=3;

end;

/

session 2

begin

update lock2 set num=3 where num=3;

end;

/

session 1

begin

update lock2 set num=3 where num=3;

end;

/

session 2

begin

update lock1 set num=3 where num=3;

end;

/

session 1 error

應用程式在做設計的時候要儘量的避免事務的粒度儘可能小

並且確保互動上鎖!

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9879835/viewspace-1030145/,如需轉載,請註明出處,否則將追究法律責任。

相關文章