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(事 ...
随机推荐
- [poj] 1269 [zoj] 1280 Interesting Lines || 求两直线交点
POJ原题 ZOJ原题 多组数据.每次给出四个点,前两个点确定一条直线,后两个点确定一条直线,若平行则输出"NONE",重合输出"LINE",相交输出" ...
- BZOJ4001 [TJOI2015]概率论 【生成函数】
题目链接 BZOJ4001 题解 Miskcoo 太神了,orz #include<algorithm> #include<iostream> #include<cstr ...
- JAVA本地文本读取---解决中文乱码
import java.io.*; public class ReadFile { public static void main(String[] args) { try { File file = ...
- 【HDU 3336 Count the string】
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...
- MAP的get与containskey
前提是:Map可以出现在k与v的映射中,v为null的情况, 所以containsKey出现更加必要. map.get(key)是得到的key所对应的value值. map.contains(key) ...
- Java并发(2)- 聊聊happens-before
引言 上一篇文章聊到了Java内存模型,在其中我们说JMM是建立在happens-before(先行发生)原则之上的. 为什么这么说呢?因为在Java程序的执行过程中,编译器和处理器对我们所写的代码进 ...
- 从Jetty、Tomcat和Mina中提炼NIO构架网络服务器的经典模式
如何正确使用NIO来构架网络服务器一直是最近思考的一个问题,于是乎分析了一下Jetty.Tomcat和Mina有关NIO的源码,发现大伙都基于类似的方式,我感觉这应该算是NIO构架网络服务器的经典模式 ...
- c#深拷贝的一个方法
使用ef,有时候会遇到,要对一个对象进行拷贝复制,可是一般的方法,拷贝后会提示此对象的实例在上下文的 entitystate已经存在,就需要用一种拷贝.简单的拷贝只拷贝了值类型,对引用类型的拷贝需要使 ...
- matlab-bgl 工具包配置环境 TDM-GCC-64 mex
Windows 64 + Matlab 64 MEX混合编程初步: http://blog.csdn.net/enjoyyl/article/details/46545263 使用的是 TDM-GCC ...
- (8)C#字符串
一.字符串 为什么说string是一个不可变的字符序列. string a="me"; a="meeeee"; string b="me" ...