参考文章 Script for killing sniped sessions shadow processes [ID 96170.1]
创建 idletime的profile,并修改用户的profile。
00 * * * * /export/home/oracle/product/10.2.0/db_1/killidle.sh
$ cat /export/home/oracle/product/10.2.0/db_1/killidle.sh
#!/bin/sh
export ORACLE_BASE=/export/home/oracle
export ORACLE_HOME=/export/home/oracle/product/10.2.0/db_1
export ORACLE_SID=demo
export PATH=$ORACLE_HOME/bin:$PATH
tmpfile=/tmp/tmp.$$
sqlplus "noap/uwaysoft2009" << EOF
set feed off;
set pages 9999 lines 170;
spool $tmpfile
select p.spid from v$process p,v$session s
where s.paddr=p.addr
and s.status='SNIPED';
spool off
EOF
for x in `cat $tmpfile | grep "^[0123456789]"`
do
kill -9 $x
done
rm $tmpfile
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25093763/viewspace-1045215/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25093763/viewspace-1045215/