Ideal Session Kill on Apps...

  • From: "Kayaroganam, Arumugam \(Customer Services, ICT - Solihull MBC\)" <akayaroganam@xxxxxxxxxxxxxxx>
  • To: <ora-apps-dba@xxxxxxxxxxxxx>
  • Date: Wed, 16 Jan 2008 12:14:55 -0000

Hi,
I would like to kill the ideal session in the mid-night on regular basis.

The below scripts is not working promptly.. do you've any idea why its not 
killed ?

#!/usr/bin/ksh
# Variables
sid=test1
user=apps
pass=xyz
sqlfile=kill_spid.lst
rm -f $sqlfile
# Here it comes
echo "Killing connections into $sid instance ..."
sqlplus $user/$pass@$sid  <<-EOF
set heading off
set feedback off
set serverout off
set echo off
set sqlnumber off
spool $sqlfile
SELECT distinct vp.spid
FROM v\$session s, v\$sesstat st, fnd_logins fl,fnd_user fu, v\$session_wait 
vw, v\$process vp
WHERE s.sid = st.sid
AND vp.addr(+) = s.paddr
AND s.sid = vw.sid(+)
AND fl.spid(+) = s.process
AND fl.end_time(+) IS NULL
AND fu.user_id(+) = fl.user_id
AND fu.user_name IS NOT NULL
/
quit;
EOF
for pid in `grep [0-9] $sqlfile`
do
        echo "Killing $pid"
        kill -9 $pid
done
echo "Database connections killed"

**********************************************************************
DISCLAIMER:
'This e-mail and files transmitted with it are confidential and intended solely 
for the use of the individual to whom it is addressed. If you are not the 
intended recipient please notify the sender immediately and delete the message. 
Any views or opinions presented are solely those of the author and do not 
necessarily represent those of Solihull Council unless explicitly stated 
otherwise. Solihull Council may monitor the contents of e-mail sent and 
received via its network for the purposes of ensuring compliance with its 
policies and procedures.'
**********************************************************************


Other related posts:

  • » Ideal Session Kill on Apps...