Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1184471
  • 博文数量: 398
  • 博客积分: 10110
  • 博客等级: 上将
  • 技术积分: 4055
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-23 20:01
个人简介

新博客http://www.cnblogs.com/zhjh256 欢迎访问

文章分类

全部博文(398)

文章存档

2012年(1)

2011年(41)

2010年(16)

2009年(98)

2008年(142)

2007年(100)

我的朋友

分类: Oracle

2007-12-25 10:52:29

使用以下的脚本对于诊断锁有一定的帮助,但是还是不能找出罪魁祸首,有更好的方法,请大侠指点
description:display the blocker and waiter,and then display the blocker's current execute statement.
SELECT distinct s.sid,
                s.serial#,
                s.username,
                decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', l.type) LOCK_LEVEL,
                o.object_name,
                l.request,
                l.lmode
  FROM v$session s, v$lock l, dba_objects o
 WHERE l.sid = s.sid
   AND l.id1 = o.object_id(+)
   AND s.username is NOT NULL;
select s.sid, s.serial#, s.username, t.sql_text
  from v$session s, v$lock l, v$sqltext t
 where s.sid = l.sid
   and s.prev_hash_value = t.hash_value
   and l.request = 0
   and l.id1 in
       (select distinct id1
          from v$lock
         where kaddr in
               (select lockwait
                  from v$session s
                 where s.lockwait is not null));
阅读(582) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~