www.7671.net > orAClE查锁表的用户

orAClE查锁表的用户

--查看被锁的表 select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;--查看那个用户那个进程照成死锁select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time;

select s.username,l.object_id, l.session_id,s.serial#, s.lockwait,s.status,s.machine,s.program from v$session s,v$locked_object l where s.sid = l.session_id;

SELECT S.SID SESSION_ID, S.USERNAME, DECODE(LMODE, 0 , ' None ' , 1 , ' Null ' , 2 , ' Row-S (SS) ' , 3 , ' Row-X (SX) ' , 4 , ' Share ' , 5 , ' S/Row-X (SSX) ' , 6 , ' Exclusive ' , TO_CHAR(LMODE)) MODE_HELD, DECODE(REQUEST, 0 , '

select s.*from v$locked_object l, dba_objects o, v$session s, v$process p where l.object_id = o.object_id and l.session_id = s.sid and s.paddr = p.addr AND object_name='AC01';表被锁住查看

查看哪个表被锁select b.owner,b.object_name,a.session_id,a.locked_modefrom v$locked_object a,dba_objects bwhere b.object_id = a.object_id查看是哪个session引起的select b.username,b.sid,b.serial#,logon_timefrom v$locked_object a,v$session bwhere a.session_id = b.sid order by b.logon_time实在不会你可以用EM来查看,比较方便

ORACLE里锁有以下几种模式:0:1:null 空2:Row-S 行共享(RS):共享表锁,sub share 3:Row-X 行独占(RX):用于行的修改,sub exclusive 4:Share 共享锁(S):阻止其他DML操作,share5:S/Row-X 共享行独占(SRX):阻止其他事务操作,share/sub exclusive 6:exclusive 独占(X):独立访问使用,exclusive 一般是自动实现的,譬如你用DDL语句,那个表肯定就是表锁定了,DML不能使这个表不能插入,只能用手工锁定这个表来实现.lock table table_name in exclusive mode NOWAIT

1、用户定义表锁 lock table ;2、任何DDL语句也将产生表级锁;如修改表结构,创建索引,统计分析,对象编译等.

oracle的锁是个庞大的体系,种类很多,建议你专门搜寻资料学习一下. 从你的问题提问来看,你应该是问事务锁,也就是常见的tx锁,即dml操作带来的锁表. ---------------------------------------------------------------------------------------------------------- 你可以

select * from V$locked_Object;就能看到那个object被锁了.如果想知道对象具体是什么,在关联一下user_objects就能知道了.

SELECT /*+ rule */ lpad(' ',decode(l.xidusn ,0,3,0))||l.oracle_username User_name,o.owner,o.object_name,o.object_type,s.sid,s.serial#FROM v$locked_object l,dba_objects o,v$session sWHERE l.object_id=o.object_idAND l.session_id=s.sidORDER BY o.object_id,xidusn DESC执行此SQL即可,结果一看便知,适用于oracle, 其他不解释~

友情链接:rpct.net | realmemall.net | zdly.net | ydzf.net | lstd.net | 网站地图

All rights reserved Powered by www.7671.net

copyright ©right 2010-2021。
www.7671.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com