我们有这个查询:
ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
我需要杀死所有具有相同 SQL ID 的会话
我不确定如何将事物连接在一起,但到目前为止我有这个:
for rec in (SELECT se.sid,ss.serial#
FROM v$session ss, v$sesstat se, v$statname sn
WHERE se.statistic# = sn.statistic#
AND name like '%CPU used by this session%'
AND se.sid = ss.sid
AND ss.status = 'ACTIVE'
AND ss.username is not null
AND ss.sql_id ='f7frew3erwe'
ORDER BY value ASC) loop
ALTER SYSTEM KILL SESSION 'rec.sid,rec.serial#' IMMEDIATE; //this is the tricky part!
end loop;
有什么建议么?