#!/bin/ksh
su - oracle << !
echo "select 'alter system kill session '''||sid||''||','||serial#||''';' from v\\\$session where username='C##SCOTT';" > sel.sql
sqlplus / as sysdba <<EOF @sel.sql 1>result.log 2>&1
exit
EOF
cat result.log | grep "alter system kill session" 1>exc.sql 2>&1
sqlplus / as sysdba <<EOF @exc.sql 1>>result.log 2>&1
exit
EOF
!