Hello All,
I am trying to write a script to check if I can connect to the database, however I am getting unmatched error:
syntax error at line 14 : `<<' unmatched
Please help, here is my original code:
#!/usr/bin/ksh
###########################################################
#instance.ksh ##
###########################################################
DBALIST="xxx@xxx.com, yyyyy@yyy.com";export DBALIST
ORATAB=/var/opt/oracle/oratab
echo "`date` "
echo "Oracle Database(s) Status `hostname` :\n"
db=`egrep -i ":Y|:N" $ORATAB | cut -d":" -f1 | grep -v "\#" | grep -v "\*"`
for i in $db ; do
sqlplus -L "/as sysdba" <<!
@test.sql
exit
!
if [ `cat test.txt|wc -l` -gt 0 ] then
echo echo "Oracle Instance - $i: Up"
else
echo "Oracle Instance - $i is Down"| mailx -s "Instance is down"$DBALIST
fi
done
I am trying to write a script to check if I can connect to the database, however I am getting unmatched error:
syntax error at line 14 : `<<' unmatched
Please help, here is my original code:
#!/usr/bin/ksh
###########################################################
#instance.ksh ##
###########################################################
DBALIST="xxx@xxx.com, yyyyy@yyy.com";export DBALIST
ORATAB=/var/opt/oracle/oratab
echo "`date` "
echo "Oracle Database(s) Status `hostname` :\n"
db=`egrep -i ":Y|:N" $ORATAB | cut -d":" -f1 | grep -v "\#" | grep -v "\*"`
for i in $db ; do
sqlplus -L "/as sysdba" <<!
@test.sql
exit
!
if [ `cat test.txt|wc -l` -gt 0 ] then
echo echo "Oracle Instance - $i: Up"
else
echo "Oracle Instance - $i is Down"| mailx -s "Instance is down"$DBALIST
fi
done