Hi and
thanks to " Danisment Gazi Unal (what does it mean ?)"
Here
is the script :
#!/bin/sh # This script make 2 things : # 1- archive alert files # 2- search "ORA-" in alert.log file # if error is found , send an email to adresses passed in parameters # # Entry parameters : # 1- SID # 2- list of emails separated by a space # Ex : % ALTERTCHECK ORCL [EMAIL PROTECTED] [EMAIL PROTECTED] # --------------------------------------------------------------- SCRIPT_DIR=/home/ORCL/script ORACLE_SID=$1 shift EMAIL=$* # Set ALERT_DIR and ALERT_FILE # ------------------------------------------ ALERT_DIR=/app/oracle/admin/$ORACLE_SID/bdump ALERT_FILE=alert_$ORACLE_SID.log ALERT_LOG=$ALERT_DIR/$ALERT_FILE ERRFILE=$SCRIPT_DIR/ALERT_ERRORS.TXT SUBJECT="Error in alert file of $ORACLE_SID" # Remove the alert file #30 # ------------------------------------------------ if [ -f $ALERT_LOG.30 ] then /bin/rm $ALERT_LOG.30 fi # Renanme the alert file, ex: 29 to 30, 28 to 29, .., 01 to 02, etc. # ------------------------------------------------------ i=29 while [ $i -ge 1 ] ; do j=`expr $i + 1` if [ -f $ALERT_LOG.$i ] then mv $ALERT_LOG.$i $ALERT_LOG.$j fi i=`expr $i - 1` done
# Rename the current alert log file to #1 # ------------------------- if [ -f $ALERT_LOG ] then mv $ALERT_LOG $ALERT_LOG.1 fi # Create a new alert file, not mandotory (Oracle will do this) # -------------------------------------------- touch $ALERT_LOG chmod 777 $ALERT_LOG # Remove the error file # --------------------------- if [ -f $ERRFILE ] then /bin/rm $ERRFILE fi
# Searching for ORA- in the alert log #1 # if error, send mail to adresses in parameters # ------------------------------------------------------- cat $ALERT_LOG.1 |grep '\ORA-' > $ERRFILE if [ -s $ERRFILE ] then cat $ERRFILE | mailx -s "$SUBJECT" $EMAIL fi
|
Title: monitoring listener.log
- monitoring listener.log NGUYEN Philippe (Cetelem)
- Re: monitoring listener.log Saurabh Sharma
- Re: monitoring listener.log Danisment Gazi Unal (Unal Bilisim)
- Re: monitoring listener.log Danisment Gazi Unal (Unal Bilisim)
- NGUYEN Philippe (Cetelem)