Oracle锁表与解锁

Oracle的锁表与解锁

SELECT /*+ rule */ s.username,
decode(l.type,'TM','TABLE LOCK',
'TX','ROW LOCK',
NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,
s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser
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

--kill session语句
alter system kill session'50,492';
\\\

select count(*) from v$locked_object;

  select * from v$locked_object;

  查看哪个表被锁

  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;

  查看是哪个session引起的

  1. 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;

  杀掉对应进程

  执行命令:alter system kill session'1025,41';

上一篇:基于tomcat的高可用性+nginx(haproxy)反向代理+session服务器memcached(redis)


下一篇:11.会话跟踪技术