在实际应用中会kill一个或几个用户的session
set termout off
set ver off
set linesize 4000
set pagesize 0
whenever sqlerror exit
set serveroutput on
set feedback off
set heading off
set pagesize 0
set pause off
set trimspool on
set verify off
动态生成需要kill的进程并形成文件killsess.sql
spool /home/oracle/killsess.sql;
select 'kill -9 '||a.spid||';' from v$process a,v$session b where a.ADDR=b.PADDR and b.schemaname in ('MARKET_NEW','PNP22','NEWSLETTER','INFOCASE','GOLDPEN','PASSPORT');
spool off
exit
EOF
从killsess.sql里取出有效部分(只含kill -9 XXXX)语句
tail -100 killsess.sql |grep '^kill -9' > afterkillsess.sh
chmod 750 afterkillsess.sh
/home/oracle/afterkillsess.sh
因oracle等下一个Pmon,所以最好sleep一下,再继续后面的程序
sleep 300
---完---
阅读(2651) | 评论(0) | 转发(0) |