Hi Gurus,
The following script fails with the error 'command not found' while trying to execute. As the error indicates, the script fails at ROW#30 where the EOF is defined for SQL statement.
It appears that the script is trying execute the lines in the SQL output written to ta spool file. However in the end, script performs the tasks as specified. But i need to have a clean exit after the execution so that I can promote it to production environment.
#!/bin/sh
. ${HOME}/.bash_profile
. ${scripts}/.dr_env.cfg
logfile=${logs}/update_ldr_conn.log
export TmpFile=$scripts/ctrl/temp.$$
printf "\n==========================================================================" >> $logfile
printf " `date` : Loader Connection update script \n" >> $logfile
printf "\n==========================================================================" >> $logfile
`sqlplus -s $SQL_LOGON << EOF
SET SERVEROUT ON
SET FEEDBACK OFF
SET HEADING OFF
SET TRIMSPOOL ON
SET TIMING OFF
SET TERMOUT OFF
SET LINES 160
SPOOL ${TmpFile}
SELECT CN.OBJECT_NAME,AT.ATTR_VALUE FROM OPB_CNX CN, OPB_CNX_ATTR AT WHERE CN.OBJECT_ID=AT.OBJECT_ID AND AT.ATTR_VALUE = '${TD_PRD_DB}';
SPOOL OFF
SET SERVEROUT OFF
exit
EOF`
echo $RC
RC=$?
if [ $RC -eq 0 ] ; then
printf "\nSuccessfully selected the rows." >> $logfile
else
printf "\nError! while trying to run the select query." >> $logfile
exit 1
fi
if [[ -s ${TmpFile} ]] ; then
printf "\nThe following TD Loader connections will be updated with DR Server information." >> $logfile
cat ${TmpFile} >> $logfile
`sqlplus -s $SQL_LOGON << EOF
SET SERVEROUT ON
SET FEEDBACK OFF
SET HEADING OFF
SET TIMING OFF
SET TERMOUT OFF
SET LINES 160
UPDATE OPB_CNX_ATTR SET ATTR_VALUE='${TD_DR_DB}' WHERE ATTR_VALUE='${TD_PRD_DB}';
COMMIT;
SET SERVEROUT OFF
exit
EOF`
echo $RC
RC=$?
if [ $RC -eq 0 ]
then
printf "\nSuccessfully updated the TD DR Database name in the Loader connections." >> $logfile
exit 0
ERROR
./ldr_conn_update.sh: line 30: TD_Tpump_Insert: command not found
0