REQUIREMENT:

Configure a shell script, to kill the snipped sessions in the database regularly.

 

SHELL SCRIPT:

# $Header: kill_snipped.sh  
# *====================================================================================+
# |  Author - DBACLASS ADMIN TEAM 
# |                                                       |
# +====================================================================================+
# |
# | DESCRIPTION
# |     Kill the snipped session in database
# | PLATFORM
# |     Linux/Solaris/HP-UX

# +===========================================================================+
#!/usr/bin/ksh
export ORACLE_HOME=/oracle/app/oracle/product/12.1.0.2/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=TESTDB
export LOG_PATH=/export/home/oracle/testdb/LOG
rm -f $LOG_PATH/snip_kill.sql

sqlplus -s /nolog << EOF
connect system/oracle
select count(*) from v\$session where status='SNIPED';
spool $LOG_PATH/session_list.log append
set lines 200 pages 1500 long 99999999
alter session set nls_date_format='DD-MON-YYYY HH24:MI';
select sysdate from dual;
select sid,serial#,event,sql_id,last_call_et,username,status,machine,logon_time,process,substr(module,1,15) module from v\$session where status='SNIPED';
spool off;
set head off;
set feed off;
set pages 0;
spool $LOG_PATH/snip_kill.sql
select 'alter system kill session '''||sid||','||serial#||''' immediate;' from v\$session where status='SNIPED' ;
spool off;
@"$LOG_PATH/snip_kill.sql"
exit;
!
date

Give 755 permission.

chmod 755 kill_snipped.sh  

Configure in crontab:

00,10,20,30,40,50 * * * * /export/home/oracle/testdb/snip_session.sh > /export/home/oracle/testdb/LOG/snip_session.log