Issue with Script - suggestion plea

March 25, 2009 at 21:53:05
Specs: IBM AIX 5.3L

Hi,

The below code giving me an error:

./auto_gather_Statistics.ksh[22]: 0403-057 Syntax error at line 42 : `<' is not matched.
$ sqlplus -silent system/R0adk!ng@pcc<<EOF
====================================

+1
+2 ######## From auto_db_monitor.ksh ######## oemprod 10.4.1.238
+3
+4
+5 . $HOME/.profile
+6
+7 DATE_VAR=$(date '+%Y%m%d_%H:%M')
+8 CURR_TIME=$(date '+%H%M%S')
+9 CURR_DAY=$(date '+%A')
+10 SCRIPTS_HOME=/oracle/admin/dba/scripts
+11
+12 ########--ERR_LOG=/oracle/log/auto_db_monitor_$DATE_VAR
+13
+14 ERR_LOG=/oracle/log/Gather_Stats/auto_db_GatherStats_$DATE_VAR
+15
+16 ########--- find /oracle/log/auto_db_monitor* -mtime +7 -exec rm -f {} \;
+17
+18 find /oracle/log/Gather_Stats/ -name "auto_db_GatherStats*" -mtime +7 -exec rm -f {} \;
+19
+20 errorcount=0
+21
+22 while read SERVER_NAME INSTANCE_NAME BLACKOUT_DAY BLACKOUT_START BLACKOUT_END SPACE_CHECK THRESHHOLD SPACE_OWNER; do
+23 cstring=`echo $SERVER_NAME|cut -c 1-1`
+24 if [ $cstring = "#" ]; then
+25 continue
+26 else
+27 if [ $BLACKOUT_DAY = $CURR_DAY \
+28 -a $CURR_TIME -gt $BLACKOUT_START \
+29 -a $CURR_TIME -lt $BLACKOUT_END \
+30 -o $BLACKOUT_DAY = 'Daily' \
+31 -a $CURR_TIME -gt $BLACKOUT_START \
+32 -a $CURR_TIME -lt $BLACKOUT_END ];
+33 then
+34 continue
+35 else
+36 if [[ ! -a ${SCRIPTS_HOME}/connect_${SERVER_NAME}_${INSTANCE_NAME}.sql ]]; then
+37 echo "File connect_${SERVER_NAME}_${INSTANCE_NAME}.sql does not exist"
+38 let errorcount=errorcount+1
+39 else
+40 ########$ORACLE_HOME/bin/sqlplus /nolog < EOF
+41 ########$ORACLE_HOME/bin/sqlplus /nolog<<EOF
+42 sqlplus -s system/R0adk!ng@pcc<<-EOF
+43 ##### whenever sqlerror exit 99
+44 ######## @${SCRIPTS_HOME}/connect_${SERVER_NAME}_${INSTANCE_NAME}.sql --------Connect t
o the database through sqlplus
+45 select * from v\$instance;
+46 #####EXEC DBMS_STATS.gather_database_stats(estimate_percent => 15 , CASCADE => TRUE );
+47 ###### EXEC sys.DBMS_STATS.gather_database_stats(estimate_percent => 15 , CASCADE => TR
UE);
+48 exit;
+49 EOF
+50 fi
+51 RET_VAL=$?
+52
+53 if [ $RET_VAL = 99 ]; then
+54 echo $INSTANCE_NAME on $SERVER_NAME is down
+55 fi
+56 fi
+57 fi
+58 done < $SCRIPTS_HOME/server_instance.txt > $ERR_LOG
+59 echo $errocount

+61 ###### RECIPIENT_LIST=""
+62 ###### while read fn
+63 ###### do
+64 ###### RECIPIENT=`echo $fn|awk -F# '{print $1}'`
+65 ###### RECIPIENT_LIST="${RECIPIENT_LIST} ${RECIPIENT}"
+66 ###### done < $SCRIPTS_HOME/Gather_Stats/recipient_list.txt
+67
+68 #########if [ $errorcount > 0 ]; then
+69 ########## if [[ $RET_VAL -gt 0 ]];
+70 ##########then
+71 ##############mail -s "DB Monitor" $RECIPIENT_LIST < $ERR_LOG
+72 uuencode $ERR_LOG |/bin/mailx -s " DB Gather Stats " krishnad@abc.com
+73 fi


Could someone help please?


See More: Issue with Script - suggestion plea

Report •


#1
March 25, 2009 at 23:08:57
please get rid of all the unnecessary comment lines and put your code in pre tags for easier viewing.

Report •

#2
March 26, 2009 at 02:29:45
Issue resolved - related to trailing spaces with 'EOF'

Thank you.


Report •

Related Solutions


Ask Question