Phuti
November 11, 2010, 9:00am
1
Hi Guys...
I am using the following codes in my script:
SID_L=`cat /var/opt/oracle/oratab|grep -v "^#"|cut -f1 -d: -s`
SID_VAR=$SID_L
for SID_RUN in $SID_VAR
do
ORACLE_HOME=`grep ^$SID_RUN /var/opt/oracle/oratab | \
awk -F: '{print $2}'` ;export ORACLE_HOME
export ORACLE_SID=$SID_RUN
But when I execute the script I get the following errors:
./db_script.sh: PRODDB: not found
Usage: grep -hblcnsviw pattern file . . .
./db_script.sh: ORACLE_SID=PRODDB: is not an identifier
What might be wrong with the code?
Please Help !!!!!!!!!
ctsgnb
November 11, 2010, 9:18am
2
you forgot the "done"
for i in ...
do
...
done
By the way, your script makes no sens to me since you export different value several time but always for the same variable (overwritting the value exported by the last loop) so only the latest one will be retained in the environment ...
methyl
November 11, 2010, 9:37am
3
What Operating System Shell are you using? This behaviour looks like a very old Bourne Shell - but I could be wrong.
Btw. Worth a glance at the supplied "oraenv" script in the "bin" directory or your Oracle.