Oracle deadlock SX/SSX caused by no index on foreign key.
Example to show the dead lock caused by lack of index on foreign key of child table.
Session 1:
create table p ( x int primary key );
create table c ( x references p );
insert into p select rownum from all_users where rownum <= 2;
insert into c select * from p;
commit;
delete from c where x = 1;
Session 2:
prompt delete from c where x = 2;
prompt delete from p where x = 2; -- session 2 will be hang.
Session 1:
delete from p where x = 1; -- session1 will be hang, deadlock will be detected after a while.
DEADLOCK DETECTED ( ORA-00060 )
[Transaction Deadlock]
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
TM-00012c11-00000000 47 138 SX SSX 45 136 SX SSX
TM-00012c11-00000000 45 136 SX SSX 47 138 SX SSX
session 138: DID 0001-002F-00000176 session 136: DID 0001-002D-00000098
session 136: DID 0001-002D-00000098 session 138: DID 0001-002F-00000176
Rows waited on:
Session 138: no row
Session 136: no row
----- Information for the OTHER waiting sessions -----
Session 136:
sid: 136 ser: 207 audsid: 384548 user: 100/TEST flags: 0x45
pid: 45 O/S info: user: SYSTEM, term: PRICNESSD, ospid: 7044
image: ORACLE.EXE (SHAD)
client details:
O/S info: user: PRICNESSD\Administrator, term: PRICNESSD, ospid: 6880:8016
machine: WORKGROUP\PRICNESSD program: sqlplus.exe
application name: SQL*Plus, hash value=3669949024
current SQL:
delete from p where x=2
----- End of information for the OTHER waiting sessions -----
Information for THIS session:
----- Current SQL Statement for this session (sql_id=dyg3c78z0ft6g) -----
delete from p where x=1
===================================================
The typical identifer for this is two SQL waiting on delete statement on one table, both transaction hold SX lock waiting on SSX lock.
Create on index on the foreign key column will resolve this problem.
create index c_idx on c(x);
Oracle deadlock SX/SSX caused by no index on foreign key.的更多相关文章
- Caused by: java.security.InvalidKeyException: Illegal key size or default parameters
How to remove the key size restriction in Java JDK? Are you developing your beautiful application us ...
- Oracle外键(Foreign Key)使用详细的说明(一)
Oracle外键(Foreign Key)使用详细的说明(一) 1.目标 演示如何Oracle使用外键数据库 2.什么是外键? 1)在Oracle数据库中,外键是用来实现參照完整性的方法之中的一个.打 ...
- Oracle之外键(Foreign Key)使用方法具体解释(二)- 级联删除(DELETE CASCADE)
Oracle外键(Foreign Key)之级联删除(DELETE CASCADE) 目标 演示样例解说怎样在Oracle外键中使用级联删除 什么是级联删除(DELETE CASCADE)? 级联删除 ...
- Caused by: java.lang.IllegalStateException: duplicate key: datasource
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/applicatio ...
- FOREIGN KEY 外键约束; UNIQUE和PRIMARY KEY 主键约束、CREATE INDEX建立索引的使用
1)foreign key 是个约束,意思是说如果你给A字段设置了外键约束,以后你要往A字段插入数据,这个数据一定是要在foreign key 后面跟的那个字段中存在的值.这个的意义就是约束了数据的完 ...
- Oracle数据库-primary key/foreign key和references关系
主要介绍一下个人对主键(primary key).外键(foreign key).候选键(Candidate key).超键(super key).references的总结 概念: 主键:用户选择元 ...
- oracle deadlock
Basic operation su - oracle sqlplus / as sysdba show parameter background show parameter user_dump_d ...
- Oracle Deadlock / 死锁 处理
Get the directory of alert log sqlplus / as sysdba show parameters udmp SQL> show parameters dump ...
- 转://oracle deadlock死锁trace file分析之一
---oracle versionSQL> select * from v$version where rownum=1;BANNER------------------------------ ...
随机推荐
- 低调的华丽,Windows Server 2003 ... 写给厌倦了XP,但又纠结于vista/win7花哨的童鞋(转)
发布于2001年10月25日的windows XP 距今已近8年 时间, 微软从没有一个操作系统能像XP那样 坚挺这么久,婚姻既有7年之痒,何况用了8年XP的广大 同学,但07年发布的vista似乎 ...
- winform学习之----Directory
Directory 文件夹目录 几个方法: CreateDirectory,delete,move,getfiles,exists 操作文件:用File 操作路径:用path 操作文件夹:Direct ...
- Myeclipse10 + JBPM4.4 环境搭建图文教程
一.软件环境 IDE:Myeclipse10.0 (jbpm4.0以上版本好像只能与Myeclipse7.5以上版本集成) JBPM:4.4 与Myeclipse集成 1.解压jbpm-4.4.zip ...
- SSH自定义分页标签
本文参考文章:http://blog.csdn.net/qjyong/article/details/3240303 一.标签处理类: package cn.conris.sys.form; impo ...
- js for循环,为什么一定要加var定义i变量
我知道,有些人(譬如之前的我)写js的for循环时,都不习惯加上var,这当然是语法允许的.譬如下面. for(i=0;i<10;i++){//就不写成: var i=0 alert(i); } ...
- 初识python面向对象
一.初识python面向对象: class Person: #使用class关键字定义一个类 age=0 #类变量(静态变量) def eat(self,food): #定义一个方法 self.age ...
- hdu 3348 coins
这道题算是一道很经典的题,很好的诠释了贪心和动态规划的不同功能.求最少钱的数量用贪心就够了,但是求最多钱的数量要用到动态规划的思想,每步都尽量保留最大 数量.具体看程序注解: #include&quo ...
- Scrum会议5
组名称:天天向上 项目名称:连连看 参会成员:王森(Master)张金生 张政 栾骄阳 时间:2016.10.20 已完成内容: 1.游戏中实现了两个按钮消除的算法. 2.在游戏中加入了音乐. 计划完 ...
- (一)win7下cocos2d-x 21 + vs2010
1.下载SDK http://cocos2d.cocoachina.com/download,我下载2.1版本,cocos2d-2.1rc0-x-2.1.2-hotfix.zip @ Apr.08, ...
- 表单序列化 js
function serliaze(form) { //序列化表单 var obj = {}; $.each(form.serializeArray(), function (index) { if ...