GalaxyPilot —— D.S


        生命不熄,战斗不止
数据加载中……

oracle 查看死锁的脚本

SELECT substr(v$lock.sid,1,4) "SID",
       substr(username,1,12) "UserName",
       substr(object_name,1,25) "ObjectName",
       v$lock.type "LockType",
       decode(rtrim(substr(lmode,1,4)),
       '2','Row-S (SS)','3','Row-X (SX)',
       '4','Share',     '5','S/Row-X (SSX)',
       '6','Exclusive', 'Other' ) "LockMode",
       substr(v$session.program,1,25) "ProgramName"
FROM V$LOCK,SYS.DBA_OBJECTS,V$SESSION
WHERE (OBJECT_ID = v$lock.id1
      AND v$lock.sid = v$session.sid
      AND username IS NOT NULL
      AND username NOT IN ('SYS','SYSTEM')
      AND SERIAL# != 1);

posted on 2006-02-24 10:51 舵手 阅读(3403) 评论(2)  编辑  收藏

评论

# re: oracle 查看死锁的脚本  回复  更多评论   

select object_id,session_id,locked_mode from v$locked_object;


select t2.username,t2.sid,t2.serial#,t2.logon_time
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid order by t2.logon_time;


select sql_text
from v$sqltext a
where a.hash_value = (
select sql_hash_value from v$session b
where b.sid=17
)
order by piece asc ;

有什么区别么
2006-03-29 15:25 | eledongzi

# re: oracle 查看死锁的脚本  回复  更多评论   

运行一下就知道结果了,区别不大,关键是除了锁你还想得到什么信息。
2006-03-29 15:43 | 舵手

只有注册用户登录后才能发表评论。


网站导航: