转自 http://blog.itpub.net/15415488/viewspace-631260
通常情况下,dead lock是由应用的不合理造成,应该由PD解决,而非DBA。但何时为非通常情况呢?
今天遇到一个case,即为非通常情况。
而他的通常的标志即为:在trc文件里的deadlock graph里,看见有SX/SSX的TM lock出现,而不全是X mode的TX lock。
而这,常常是因为foreign key没有index。(相信很多人都已经有这个经验了)
但我今天遇到的更加特殊一点的情况是,deadlock graph里,一个session等在SSX mode TM lock上,另一个等在X mode TX lock上。
而对于foreign key没有index的情况,我们常常见到的是两个sessions都等在SSX mode TM lock上。 综上,deadlock是个挺有趣的东西。
What to do with "ORA-60 Deadlock Detected" Errors [ID 62365.1]
for a list of when TX locks are requested in
mode 4.
TM SSX (mode 5) This is usually related to the existence of
or foreign key constraints where the columns
S (mode 4) are not indexed on the child table.
See Note:33453.1 for how to locate such
constraints. See below for locating
the OBJECT being waited on.
Although other deadlock scenarios can happen the above are the most common.