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 s WHERE l.object_id=o.object_id AND l.session_id=s.sid ORDER BY o.object_id,xidusn DESC 运行下就可以查出来了
--查看某个表被谁锁定 select t2.username, t2.sid, t2.serial#, t2.logon_time, t3.object_name from v$locked_object t1, v$session t2, user_objects t3 where t1.session_id = t2.sid and t1.object_id = t3.object_id order by t2.logon_time--杀掉进程 alter system kill session 'sid,serial#'; ---sid,serial#对应上面语句查出的value
o.owner,o.object_name,o.object_type,s.sid,s.serial#
FROM v$locked_object l,dba_objects o,v$session s
WHERE l.object_id=o.object_id
AND l.session_id=s.sid
ORDER BY o.object_id,xidusn DESC
运行下就可以查出来了
select t2.username, t2.sid, t2.serial#, t2.logon_time, t3.object_name
from v$locked_object t1, v$session t2, user_objects t3
where t1.session_id = t2.sid
and t1.object_id = t3.object_id
order by t2.logon_time--杀掉进程
alter system kill session 'sid,serial#'; ---sid,serial#对应上面语句查出的value