问题
I need somebody help me to figure out the cause of following deadlock. the involved tables are parent/child and child table has indexed FK. parent:PK_FMS_FC_MAIN_FLD_INPUT_LIMIT chile:FMS_FC_REL_FLD_INPUT_LIMIT
Deadlock graph:
---------Blocker(s)-------- ---------Waiter(s)---------
Resource Name process session holds waits process session holds waits
TX-0019000b-0000b486 22 2755 X 57 492 S
TX-00010019-00061e13 57 492 X 22 2755 S
session 2755: DID 0001-0016-00000FCE session 492: DID 0001-0039-00000719
session 492: DID 0001-0039-00000719 session 2755: DID 0001-0016-00000FCE
Rows waited on:
Session 2755: obj - rowid = 000DB256 - AADbJWABbAAAYJQAAA
(dictionary objn - 897622, file - 91, block - 98896, slot - 0)
Session 492: no row
----- Information for the OTHER waiting sessions -----
Session 492:
sid: 492 ser: 2757 audsid: 132281277 user: 364/GKS_IM_9990740
flags: (0x41) USR/- flags_idl: (0x1) BSY/-/-/-/-/-
flags2: (0x40009) -/-/INC
pid: 57 O/S info: user: grid, term: UNKNOWN, ospid: 16372
image: oracle@hgksdb01
client details:
O/S info: user: imart, term: unknown, ospid: 1234
machine: hgkswa05 program: JDBC Thin Client
application name: JDBC Thin Client, hash value=2546894660
current SQL:
DELETE FROM FMS_FC_MAIN_FLD_INPUT_LIMIT MAIN WHERE MAIN.ID = :B1
----- End of information for the OTHER waiting sessions -----
Information for THIS session:
----- Current SQL Statement for this session (sql_id=56azrvwd48huf) -----
INSERT INTO FMS_FC_REL_FLD_INPUT_LIMIT( ID, RELATION_FIELD_MASTER_CD, CREATE_USER_CD, CREATE_DATE, RECORD_USER_CD, RECORD_DATE ) VALUES( :B4 , :B3 , :B2 , SYSDATE, :B1 , SYSDATE )
----- PL/SQL Stack -----
----- PL/SQL Call Stack -----
object line object
handle number name
0x1f37f7a58 462 package body GKS_IM_9990740.ZPKG_PRJ_FLDREL
0x1ed1a9d38 1 anonymous block
===================================================
CREATE TABLE GKS_IM_9990740.FMS_FC_MAIN_FLD_INPUT_LIMIT
(
ID NUMBER(18,0) NOT NULL,
COMPANY_CD VARCHAR2(100) NOT NULL,
MAIN_FIELD_TYPE VARCHAR2(100) NOT NULL,
RELATION_FIELD_TYPE VARCHAR2(100) NOT NULL,
START_DATE DATE NOT NULL,
MAIN_FIELD_MASTER_CD VARCHAR2(1000) NOT NULL,
MAIN_FIELD_SUB_CD VARCHAR2(1000),
IS_INPUT_ENABLE VARCHAR2(1) NOT NULL,
IS_INPUT_COMPULSORY VARCHAR2(1) NOT NULL,
DEFAULT_VALUE VARCHAR2(1000),
IS_INPUT_LIMIT VARCHAR2(1) NOT NULL,
CREATE_USER_CD VARCHAR2(100) NOT NULL,
CREATE_DATE TIMESTAMP(6) NOT NULL,
RECORD_USER_CD VARCHAR2(100),
RECORD_DATE TIMESTAMP(6),
CONSTRAINT PK_FMS_FC_MAIN_FLD_INPUT_LIMIT PRIMARY KEY (ID) USING INDEX
PCTFREE 10
INITRANS 2
MAXTRANS 255
TABLESPACE FMS_DATA
STORAGE(INITIAL 64K NEXT 1M MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT)
LOGGING
)
CREATE TABLE GKS_IM_9990740.FMS_FC_REL_FLD_INPUT_LIMIT
(
ID NUMBER(18,0) NOT NULL,
RELATION_FIELD_MASTER_CD VARCHAR2(1000) NOT NULL,
CREATE_USER_CD VARCHAR2(100) NOT NULL,
CREATE_DATE TIMESTAMP(6) NOT NULL,
RECORD_USER_CD VARCHAR2(100),
RECORD_DATE TIMESTAMP(6),
CONSTRAINT PK_FMS_FC_REL_FLD_INPUT_LIMIT PRIMARY KEY (ID, RELATION_FIELD_MASTER_CD) USING INDEX
PCTFREE 10
INITRANS 2
MAXTRANS 255
TABLESPACE FMS_DATA
STORAGE(INITIAL 64K NEXT 1M MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT)
LOGGING,
CONSTRAINT FK_FMS_FC_REL_FLD_INPUT_LIMIT0 FOREIGN KEY (ID) REFERENCES GKS_IM_9990740.FMS_FC_MAIN_FLD_INPUT_LIMIT (ID)
)
PCTFREE 10
MAXTRANS 255
TABLESPACE FMS_DATA
STORAGE(INITIAL 64K NEXT 1M MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT)
NOCACHE
LOGGING
CREATE INDEX "GKS_IM_9990740"."FK_FMS_FC_REL_FLD_INPUT_LIMIT" ON "GKS_IM_9990740"."FMS_FC_REL_FLD_INPUT_LIMIT"
(
"ID"
)
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
(
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
)
TABLESPACE "FMS_DATA" ;
回答1:
Some thoughts: 1.) Since the enqueues involved in the deadlock are TX, and not TM, this has nothing to do with the unindexed foreign key problem. 2.) Since the sessions are waiting on TX 'S' (shared) mode, this is not a row-level locking problem. 3.) Since one of the statements involved is an INSERT, that one is not going to be a problem with ITL slot shortage.
So, given the above, my best guesses are: For the delete, bitmap index or ITL slot shortage. for the insert, overlapping pk/uk.
Hope that helps....
来源:https://stackoverflow.com/questions/19853691/oracle-deadlock-parent-child-and-child-has-indexed-fk