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的更多相关文章

  1. Oracle Deadlock / 死锁 处理

    Get the directory of alert log sqlplus / as sysdba show parameters udmp SQL> show parameters dump ...

  2. 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 ...

  3. 转://oracle deadlock死锁trace file分析之一

    ---oracle versionSQL> select * from v$version where rownum=1;BANNER------------------------------ ...

  4. 【锁】Oracle死锁(DeadLock)的分类及其模拟

    [锁]Oracle死锁(DeadLock)的分类及其模拟 1  BLOG文档结构图 2  前言部分 2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不 ...

  5. 【Oracle-DBA】Oracle连接非常慢APPARENT DEADLOCK

    我是一名软件包工头,哪里有问题就干哪里. 这次是 Oracle 出毛病了,我就临时兼了DBA的职,没办法,谁叫我是工头呢.打开百度就开干. 这次关键词是:APPARENT DEADLOCK!!! 丫的 ...

  6. Oracle死锁

    当两个或多个用户相互等待锁定的数据时就会发生死锁,这时这些用户被卡在不能继续处理业务,oracle可以自动检测死锁并解决他们,通过回滚一个死锁中的语句,释放锁定的数据,回滚的话会遇到ora-00060 ...

  7. 归档—监控ORACLE数据库告警日志

    ORACLE的告警日志里面包含许多有用的信息,尤其是一些ORACLE的ORA错误信息,所以有必要及时归档.监控数据库告警日志的ORA错误,及时提醒数据库管理员DBA处理这些错误信息,那么我们首先来看看 ...

  8. 关于Oracle AUTONOMOUS TRANSACTION(自治事务)的介绍

    AUTONOMOUS TRANSACTION(自治事务)的介绍 在基于低版本的ORACLE做一些项目的过程中,有时会遇到一些头疼的问题,比如想在执行当前一个由多个DML组成的transaction(事 ...

  9. (转)关于Oracle AUTONOMOUS TRANSACTION(自治事务)的介绍

    AUTONOMOUS TRANSACTION(自治事务)的介绍 在基于低版本的ORACLE做一些项目的过程中,有时会遇到一些头疼的问题,比如想在执行当前一个由多个DML组成的transaction(事 ...

随机推荐

  1. 刷题总结——Throw nails(hdu4393)

    题目: Problem Description The annual school bicycle contest started. ZL is a student in this school. H ...

  2. [解决方案]未能找到路径“~\bin\roslyn\csc.exe”的一部分

    我的WebApi项目使用Nuget加载了一些包以后出现了这样的问题,本地可以访问,但发布到线上后,出现这样的报错 这个问题出现的原因是Nuget的时候,多加载了一些项目可能不需要的依赖库所导致的. 解 ...

  3. Visual Studio中的/MD, /MT, /MDd, /MTd 选项

    Visual Studio中/MD, /MT, /MDd, /MTd表示多线程模块是否为dll.对于这几个选项我的理解如下: /MD: 定义了_MT和_DLL,让程序用多线程和dll版本的运行库. / ...

  4. VMware Storage VMotion概述及功能

    可以跨存储阵列实时迁移虚拟机磁盘文件.VMware Storage VMotion 使您可以在共享存储位置之间和跨共享存储位置重新分配虚拟机磁盘文件,同时保证连续的服务供应和事务处理的完整性. 1.可 ...

  5. Linux下的ACL

    ACL理论概述 9位的属主/属组/其他人访问控制系统已经得到证明是强大的,足以满足大多数管理方面的需求. 事实上,在所有非UNIX操作系统上都采用了一种实质上更为复杂的方式来管理对于文件的访问:访问控 ...

  6. Spring数据访问之JdbcTemplate

    Spring数据访问之JdbcTemplate 使用JdbcTemplate的基本操作步骤 1.引jar包

  7. 无法更新 EntitySet“W_ReceiveData”,因为它有一个 DefiningQuery,而 <ModificationFunctionMapping> 元素中没有支持当前操作的 <InsertFunction> 元素。

    无法更新 EntitySet“W_ReceiveData”,因为它有一个 DefiningQuery,而 <ModificationFunctionMapping> 元素中没有支持当前操作 ...

  8. Hashmap与Hashtable的区别及Hashmap的原理

    Hashtable和HashMap有几个主要的不同:线程安全以及速度.仅在你需要完全的线程安全的时候使用Hashtable,而如果你使用Java 5或以上的话,请使用ConcurrentHashMap ...

  9. 经常用的Jquery图片轮转

    1.HTML结构 <div class="main_view">                 <div class="window"> ...

  10. Laravel使用db:seed生成测试数据

    创建 生成数据 定义字段 call方法调用 执行 seeder里如有多个可指定class 整理自www.laravist.com 视频教程