Home » Infrastructure » Unix » Sometimes getting SP2-0734 error message (shell script)
Sometimes getting SP2-0734 error message [message #643622] Wed, 14 October 2015 00:57 Go to next message
praveenk768
Messages: 5
Registered: October 2015
Junior Member
Hi All,
Once I try to execute the below script,it will execute the script and it will generate the output file.
Sometimes,it got executed successfully and generate the output file.. sometimes,it got executed and generate the output with error message as
********************************* Top of Data **********************************
SP2-0734: unknown command beginning "PATH=/u01/..." - rest of line ignored.
SP2-0734: unknown command beginning "sqlplus -S..." - rest of line ignored.
******************************** Bottom of Data

Can anyone pls tell me why its showing this error message.

Shell script:
SQL_FILE=/ftp/otmtms/config/test.sql
#SID=OTM60APL2D
SID=OAPL2P
RUN_DATE=$(date +%Y%m%d%H%M%S)
 
function build_sql (){
tempfile=/tmp/.exec_$RUN_DATE
echo "# Set ORACLE_HOME and related variables" > $tempfile
echo "ORACLE_HOME=/u01/app/oracle/product/11.2.0; export ORACLE_HOME" >> $tempfile
echo "LD_LIBRARY_PATH=\$ORACLE_HOME/lib:\$LD_LIBRARY_PATH; export LD_LIBRARY_PATH" >> $tempfile
echo "NLS_LANG=American_America.UTF8; export NLS_LANG" >> $tempfile
echo "# Set PATH" >> $tempfile
echo "PATH=\$ORACLE_HOME/bin:\$PATH; export PATH" >> $tempfile
echo "sqlplus -S /nolog <<EOF" >> $tempfile
echo "spool /ftp/test/IVin2_OTM_$RUN_DATE.FCNA" >> $tempfile
echo " whenever sqlerror exit FAILURE" >> $tempfile
echo " connect SHIPMAXOWNER/shipmaxowner@$SID " >> $tempfile
echo " @$SQL_FILE" >> $tempfile
echo "EOF" >> $tempfile
#Execute SQL
sh $tempfile
}
build_sql
Re: Sometimes getting SP2-0734 error message [message #643624 is a reply to message #643622] Wed, 14 October 2015 01:16 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You get this error when the lines you think they are executed at shell level are actually executed at sqlplus one.
To debug you have to
1/ Display the generated file before executing it
2/ Search everywhere you call this script

I don't see why you generate a file to execute it and do not directly execute the generated file. There is nothing generated that can't be in the script.

Try this script:
SQL_FILE=/ftp/otmtms/config/test.sql
#SID=OTM60APL2D
SID=OAPL2P
RUN_DATE=$(date +%Y%m%d%H%M%S)
tempfile=/tmp/.exec_$RUN_DATE
# Set ORACLE_HOME and related variables
ORACLE_HOME=/u01/app/oracle/product/11.2.0; export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
NLS_LANG=American_America.UTF8; export NLS_LANG
# Set PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
sqlplus -S /nolog <<EOF
spool /ftp/test/IVin2_OTM_$RUN_DATE.FCNA
whenever sqlerror exit FAILURE
connect SHIPMAXOWNER/shipmaxowner@$SID
@$SQL_FILE
EOF


Re: Sometimes getting SP2-0734 error message [message #643625 is a reply to message #643624] Wed, 14 October 2015 01:31 Go to previous messageGo to next message
praveenk768
Messages: 5
Registered: October 2015
Junior Member
Thanks Michel for helping me on this.
I am new to shell script. I will explain my understanding

1.We placed this shell script in the server. we schedule to run this script daily.

2.Once the shell scripts runs , I guess it will call test.sql sql file(SQL_FILE=/ftp/otmtms/config/test.sql) and it will generate the output file
->IVin2_OTM_$RUN_DATE.FCNA(spool /ftp/test/IVin2_OTM_$RUN_DATE.FCNA) and place it server.
3.lets say, on monday script got executed and placed the file in server WITHOUT ANY ERROR MESSAGE. Next day(tuesday),it got executed and placed the file in the server WITH ERROR MESSAGE.
4.I guess, if there any issue in the script, it supposed to generate the output file with error message on everyday right? But I am getting an error message on alternative days . I guess

can you please provide your feedback on this.
Re: Sometimes getting SP2-0734 error message [message #643626 is a reply to message #643625] Wed, 14 October 2015 01:33 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I gave you my feedback, I'd change your script to mine.

Previous Topic: Why oracle instance doesn't shutdwon after deleting system datafile?
Next Topic: Need small modification in shell script
Goto Forum:
  


Current Time: Thu Mar 28 11:26:45 CDT 2024