oracle deadlock
Basic operation
su - oracle
sqlplus / as sysdba
show parameter background
show parameter user_dump_dest
background_dump_dest: path_to_trace_file
deadlook error code is: ORA-00060
Refer to dead lock article
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1528515465282
one example of dead lock
I'm going to hypothesize that there is a unique index on some (at least one) of the columns being
updated. The locks are NOT on a row -- they are due to unique conflicts. Here is exactly how to simulate
this: --------------------- test.sql -------------------------
drop table t;
create table t ( x int primary key );
insert into t values ( 1 );
insert into t values ( 2 );
insert into t values ( 3 );
insert into t values ( 4 );
commit;
update t set x = 5 where x = 1;
REM in another session, run test2.sql
pause
update t set x = 6 where x = 2;
--------------------------------------------------------- -------------------- test2.sql ---------------------------
variable x1 number
variable x2 number
exec :x1 := 6; :x2 := 3;
update t set x = :x1 where x = :x2;
exec :x1 := 5; :x2 := 4;
update t set x = :x1 where x = :x2;
--------------------------------------------------------- Here, session 1 will get the row updated from 1 to 5 -- 5 will be "locked" in the index. Session 2 will then update 3 to 6 (no conflict, but 6 is "locked" in the index) Session 2 will then update 4 to 5 -- this'll be a conflict, unique key violation POSSIBLE at this
point. Session 2 will block here. Next, session 1 tries to update 2 to 6 -- that'll be another conflict with session 2, unique key
violation POSSIBLE at this point. Session 1 will block and then one of the sessions will get the
dead lock. That is when this trace file will be produced: *** SESSION ID:(8.3883) 2002-08-07 11:09:23.816
DEADLOCK DETECTED
Current SQL statement for this session:
update t set x = :x1 where x = :x2
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-0003003d-000011e2 14 8 X 8 7 S
TX-00020054-0000109e 8 7 X 14 8 S
session 8: DID 0001-000E-00000002 session 7: DID 0001-0008-00000002
session 7: DID 0001-0008-00000002 session 8: DID 0001-000E-00000002
Rows waited on:
Session 7: no row
Session 8: no row
=================================================== So, basically, you have two sessions doing this update (or a similar update) and they are bumping
into each other with a unique index. Look for whats unique in this table. It isn't a row lock issue -- rather, an index key collision that is happening. Further down in the trace file, you should be seeing something like: ...
Cursor frame allocation dump:
frm: -------- Comment -------- Size Seg Off
bind 0: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=03 oacfl2=0 size=48 offset=0
bfp=01a70280 bln=22 avl=02 flg=05
value=5 <<<<<=== the bind variable values
bind 1: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=03 oacfl2=0 size=0 offset=24 <<<<<===
the bind variable values
bfp=01a70298 bln=22 avl=02 flg=01
value=4
End of cursor dump
***************** dump of cursor xsc=1a7681c **********************
........ And that should help you ID where the problem is (you'll see the BR_NO and be able to identify the
ROWS being modified)
oracle deadlock的更多相关文章
- Oracle Deadlock / 死锁 处理
Get the directory of alert log sqlplus / as sysdba show parameters udmp SQL> show parameters dump ...
- 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: crea ...
- 转://oracle deadlock死锁trace file分析之一
---oracle versionSQL> select * from v$version where rownum=1;BANNER------------------------------ ...
- 【锁】Oracle死锁(DeadLock)的分类及其模拟
[锁]Oracle死锁(DeadLock)的分类及其模拟 1 BLOG文档结构图 2 前言部分 2.1 导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不 ...
- 【Oracle-DBA】Oracle连接非常慢APPARENT DEADLOCK
我是一名软件包工头,哪里有问题就干哪里. 这次是 Oracle 出毛病了,我就临时兼了DBA的职,没办法,谁叫我是工头呢.打开百度就开干. 这次关键词是:APPARENT DEADLOCK!!! 丫的 ...
- Oracle死锁
当两个或多个用户相互等待锁定的数据时就会发生死锁,这时这些用户被卡在不能继续处理业务,oracle可以自动检测死锁并解决他们,通过回滚一个死锁中的语句,释放锁定的数据,回滚的话会遇到ora-00060 ...
- 归档—监控ORACLE数据库告警日志
ORACLE的告警日志里面包含许多有用的信息,尤其是一些ORACLE的ORA错误信息,所以有必要及时归档.监控数据库告警日志的ORA错误,及时提醒数据库管理员DBA处理这些错误信息,那么我们首先来看看 ...
- 关于Oracle AUTONOMOUS TRANSACTION(自治事务)的介绍
AUTONOMOUS TRANSACTION(自治事务)的介绍 在基于低版本的ORACLE做一些项目的过程中,有时会遇到一些头疼的问题,比如想在执行当前一个由多个DML组成的transaction(事 ...
- (转)关于Oracle AUTONOMOUS TRANSACTION(自治事务)的介绍
AUTONOMOUS TRANSACTION(自治事务)的介绍 在基于低版本的ORACLE做一些项目的过程中,有时会遇到一些头疼的问题,比如想在执行当前一个由多个DML组成的transaction(事 ...
随机推荐
- UVA 10652 Board Wrapping(二维凸包)
传送门 刘汝佳<算法竞赛入门经典>P272例题6包装木板 题意:有n块矩形木板,你的任务是用一个面积尽量小的凸多边形把它们抱起来,并计算出木板占整个包装面积的百分比. 输入:t组数据,每组 ...
- 战斗机的祈雨仪式(NOIP模拟赛Round 7)
[问题描述] 炎炎夏日,如果没有一场大雨怎么才能尽兴?秋之国的人民准备了一场祈雨仪式.战斗机由于拥有操纵雷电的能力,所以也加入了其中,为此,她进行了一番准备. 战斗机需要给自己的Spear of Lo ...
- VS2013 更改MFC标题栏图标和生成的执行文件图标
创建一个新工程,可以什么都不加.打开.rc, 创建或打开Icon资源(以下都以Icon为例). 单击工程窗口的资源视图标签,选中资源ID为IDR_MAINFRAME图标资源,然后按Delet ...
- PO-BO-VO-DTO-POJO-DAO
POJO,BO,VO的关系: 简单理解:http://www.blogjava.net/vip01/archive/2007/01/08/92430.html 全面:https://www.cnblo ...
- linux的文件布局
/bin---权限为 rwxr-xr-x 所有者为root/root 用户bin最先进入的工作目录就是这里.这里放置的是执行目录,但是特殊在这里的命令可以被一般用户使用(root更能使用).例如 ca ...
- python接口自动化9-https请求(SSL)【转载】
本篇转自博客:上海-悠悠 原文地址:http://www.cnblogs.com/yoyoketang/tag/python%E6%8E%A5%E5%8F%A3%E8%87%AA%E5%8A%A8%E ...
- Centos7一键安装lnmp脚本
mkdir /root/softwarewget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.18.tar.gzwget https ...
- hdu 5163(前缀和+分类讨论)
Taking Bus Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- spring JPA写法一种
第一次用,搞了半天,终于知道了大概. 基于ORM的JPA还是蛮好用的, 这次是实现一个MANGODB的日志存储和检索. PRISM用的. repository的写法: package paic.sto ...
- 利用NPOI组件产Excel完整操作
最终还是要使用NPOi了.刚开始做的是用com组件,发现如果本机不按照excel就不能使用,后来把其中一支改为了用Itextsharp产生pdf,但是还有几支批次要产生Excel,只能改用NPOI了. ...