oracle线程杀不掉,强制杀进程

SELECT l.session_id sid,
s.serial#,
l.locked_mode,
l.oracle_username,
l.os_user_name,
s.machine,
s.terminal,
o.object_name,
s.logon_time
FROM v$locked_object l, all_objects o, v$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid
ORDER BY sid, s.serial#;


select b.sql_text
from v$session a, v$sql b
where a.sid = 1501 --这块写之前执行过的查询锁表SQL中获取到的SID 写在这里
and a.SQL_ADDRESS = b.ADDRESS(+);

--杀进程
alter system kill session '29,57107';
;
--如果进程杀不掉报ORA_00031责执行下面SQL查出来线程 kill -9 下面SQL结果 来关闭线程,慎重使用
select spid, osuser, s.program
from v$session s,v$process p
where s.paddr=p.addr and s.sid=29
;
--批量执行杀进程操作
SELECT 'alter system kill session '''||l.session_id||','||s.serial#||''';', l.session_id,
s.serial#,
l.locked_mode,
l.oracle_username,
l.os_user_name,
s.machine,
s.terminal,
o.object_name,
s.logon_time
FROM v$locked_object l, all_objects o, v$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid
ORDER BY sid, s.serial#;
--恢复数据
select * from tf_accountsubject as of timestamp to_timestamp('2020-06-24 13:45:44','yyyy-mm-dd hh24:mi:ss')

posted @ 2020-07-06 19:11  摸鱼儿  阅读(1148)  评论(0编辑  收藏  举报