kapanmayan sqller

set head off;
spool kill.sql;
select 'alter system kill session'||' '''||s.sid||','||s.serial#||''';'
from audit_actions a, v$process p, v$session s, v$sqlarea area
where s.paddr = p.addr
and a.action(+) = s.command
and s.sql_address = area.address
and s.sql_hash_value = area.hash_value
--and status = 'ACTIVE'
and type != 'BACKGROUND'
and (sql_text like '%||EMPLOYEE_SURNAME||%'
or sql_text like '%select distinct TEAM_NAME from xxpf_RAINBOW_USERS where end_date is null order by 1 asc%'
or sql_text like '%select distinct LOCATION_NAME from xxpf_RAINBOW_USERS where end_date is null order by 1 asc%'
)
and decode(s.terminal, NULL, p.terminal, s.terminal) <>'XT40';
spool off;

sqlplus apps@prod < kill.sql

Hiç yorum yok: