杀掉锁表进程

-------查询锁表的所有进程
select a.OS_USER_NAME, c.owner, c.object_name, b.sid, b.serial#, logon_time
from v$locked_object a, v$session b, dba_objects c
where a.session_id = b.sid
and a.object_id = c.object_id
order by b.logon_time;
 
-------杀掉单个的进程 sid,serial#
alter system kill session '210,11562';
 
-------杀掉所有的进程
declare cursor mycur is
select b.sid,b.serial#
  from v$locked_object a,v$session b
  where a.session_id = b.sid group by b.sid,b.serial#;
 
begin
for cur in mycur
loop
execute immediate ( 'alter system kill session '''||cur.sid || ','|| cur.SERIAL# ||''' ');
end loop;
end;
 
-------手动杀进程:点击Oracle 的菜单栏“工具-会话”,查看进程列,右键点击关闭,可以杀掉进程。
posted @ 2019-03-21 09:49  宿花影  阅读(639)  评论(0编辑  收藏  举报