Monday, April 03, 2006

 

Shell Script

Hola,

Por favor chequen en el siguiente shell script, este puede servir como ejemplo en el examen.
inst_mon.sh
#!/bin/sh
# inst_mon.sh - utility for
# database instances monitoring
ORACLE_HOME=/opt/ora/app/oracle/product/7.3.4
export ORACLE_HOME
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH
export PATH
cd /opt/ora/utils
umask 177
timeout=10
threshold=50
for SID in `cat instances.cfg | nawk ‘{print $1}’`
do
ORACLE_SID=$SID
export ORACLE_SID
connect_string=`grep "^$SID" instances.cfg| nawk ‘{print $2}’`
af=$SID.alarm
log_file=$SID.log
sqlplus $connect_string <>&1 > $log_file &
sleep $timeout
is_conn=`grep -c Connected $log_file`
is_time_busy=`grep -c time_busy $log_file`
if test $is_conn -ne 1
then
echo "Subject: Problems with " $SID "instance!" > $af
echo "No connection in " $timeout " seconds." >> $af
mail `cat admins.cfg` < $af fi if test $is_time_busy -eq 1 then time_busy=`grep time_busy $log_file | nawk ‘{print $2}’` if test $time_busy -gt $threshold then echo "Subject: Problems with " $SID "instance!" > $af
echo "Dispatchers utilization:" $time_busy "%" >> $af
echo "Tune MTS_MAX_DISPATCHERS!" >> $af
mail `cat admins.cfg` < $af fi fi done exit 0
Saludos

RDE

Comments:
por lo que entiendo se busca en el path de oracl todas las intancias existentes en el directorio de oracle y checa si la conexion esta ocupada o no, hay varias lineas que no entiendo y no a que se refiere, parece que da un tiempo de respuesta y pasando ese tiempo de respuesta y no se logra una respuesta de la instancia marca que no hay conexción
 
De lo que pude entender de este scrip es que busca las instancias de oracle y verifica si estan conectadas, de no ser asi indica cuanto tiempo lleva sin estarlo.
Hay algunas lineas que no logro entender muy bien, pero espero que con el paso del tiempo llegue hacerlo.
 
This comment has been removed by the author.
 
He aqui los blog de la tarea sobre la noticia IT

http://www.mayravj.blogspot.com/

http://bddistribuidas-manuelrdzm.blogspot.com/
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?