Issue with Script - suggestion please
Dear Sir,
I am getting an error :
./auto_gather_Statistics.ksh[22]: 0403-057 Syntax error at line 42 : `<' is not matched.
from the follwing code:
######## From auto_db_monitor.ksh ######## oemprod 10.4.1.238
. $HOME/.profile
DATE_VAR=$(date '+%Y%m%d_%H:%M')
CURR_TIME=$(date '+%H%M%S')
CURR_DAY=$(date '+%A')
SCRIPTS_HOME=/oracle/admin/dba/scripts
########--ERR_LOG=/oracle/log/auto_db_monitor_$DATE_VAR
ERR_LOG=/oracle/log/Gather_Stats/auto_db_GatherStats_$DATE_VAR
########--- find /oracle/log/auto_db_monitor* -mtime +7 -exec rm -f {} \;
find /oracle/log/Gather_Stats/ -name "auto_db_GatherStats*" -mtime +7 -exec rm -f {} \;
errorcount=0
while read SERVER_NAME INSTANCE_NAME BLACKOUT_DAY BLACKOUT_START BLACKOUT_END SPACE_CHECK THRESHHOLD SPACE_OWNER; do
cstring=`echo $SERVER_NAME|cut -c 1-1`
if [ $cstring = "#" ]; then
continue
else
if [ $BLACKOUT_DAY = $CURR_DAY \
-a $CURR_TIME -gt $BLACKOUT_START \
-a $CURR_TIME -lt $BLACKOUT_END \
-o $BLACKOUT_DAY = 'Daily' \
-a $CURR_TIME -gt $BLACKOUT_START \
-a $CURR_TIME -lt $BLACKOUT_END ];
then
continue
else
if [[ ! -a ${SCRIPTS_HOME}/connect_${SERVER_NAME}_${INSTANCE_NAME}.sql ]]; then
echo "File connect_${SERVER_NAME}_${INSTANCE_NAME}.sql does not exist"
let errorcount=errorcount+1
else
########$ORACLE_HOME/bin/sqlplus /nolog < EOF
########$ORACLE_HOME/bin/sqlplus /nolog<
$ORACLE_HOME/bin/sqlplus system/PWD@pcc<<-EOF ##### whenever sqlerror exit 99
######## @${SCRIPTS_HOME}/connect_${SERVER_NAME}_${INSTANCE_NAME}.sql --------Connect to the da
tabase through sqlplus
select * from v\$instance;
"auto_gather_Statistics.ksh" 83 lines, 3058 characters
###### RECIPIENT_LIST=""
###### while read fn
###### do
###### RECIPIENT=`echo $fn|awk -F# '{print $1}'`
###### RECIPIENT_LIST="${RECIPIENT_LIST} ${RECIPIENT}"
###### done < $SCRIPTS_HOME/Gather_Stats/recipient_list.txt
#########if [ $errorcount > 0 ]; then
########## if [[ $RET_VAL -gt 0 ]];
##########then
##############mail -s "DB Monitor" $RECIPIENT_LIST < $ERR_LOG
uuencode $ERR_LOG |/bin/mailx -s " DB Gather Stats " krishnad@michaels.com
fi
The relevant line 42 is given in bold..... The above script is basically trying to connect to the different databases and gather the statistics.
Can anyone help me with what that error means and how it can be resolved please
The portion actually looks like this:(The complete code is attached)
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<
+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
Attached Files
Problem resolved - extra characters to the sides of EOF was removed and issue resolved........
You should think about changing the "R0adk!ng" password and not using it anymore. Also if you aren't using Oracle 11g using upper case letter won't help you. Although I guess you can turn that on in 10g.
And who elected you road king anyway???
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width