#!/bin/ksh -x
# First, we must set the environment . . . .
ORACLE_SID=fdprod
export ORACLE_SID
ORACLE_HOME=/orastdbybin/fdprod/product/10.2
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
SERVER_NAME=`hostname`
typeset -u SERVER_NAME
export SERVER_NAME
# sample every two minutes (120 seconds) . . . .
SAMPLE_TIME=30
while true
do
vmstat ${SAMPLE_TIME} 2 > /tmp/msg$$
cat /tmp/msg$$|sed 1,7d | awk ‘{ printf(“%s %s %s %s %s %s %sn”, $1, $6, $7, $14, $15, $16, $17 ) }’ | while read RUNQUE PAG
E_IN PAGE_OUT USER_CPU SYSTEM_CPU IDLE_CPU WAIT_CPU
do
$ORACLE_HOME/bin/sqlplus fdba/dba101<
$WAIT_CPU);
EXIT
EOF
done
done
rm /tmp/msg$$