Not able to export ORACLE_SID and ORACLE_HOME [message #544557] |
Wed, 22 February 2012 07:31 |
pokhraj_d
Messages: 117 Registered: December 2007
|
Senior Member |
|
|
Hi All,
I have written one script which will check all the instance name from oratab file and list the instance name along with the respective home.
But when I choose the ORACLE_SID name from list it is not exporting the ORACLE_HOME as well as SID properly to set the environment.
Please find the script below :-
===============================
funDBLISTHOME ()
{
cat /etc/oratab | grep -v "^#" | awk -F: '{print $1,"<---->",$2}'
}
#VARIABLES
typeset -u ORACLESID
DATE=`date +%d-%m-%Y`
HOSTNAME=`hostname`
#MAIN PROGRAM
clear
echo "\t\tCurrent Date: $DATE"
echo "\t\tHostname :$HOSTNAME"
echo "\n=============DATABASE LIST============================\n"
funDBLISTHOME
echo "\n==============END OF LIST=============================\n"
echo "Choose your Instance Name:\c"
read option
export ORACLE_SID=${option}
export ORACLE_HOME=`cat /etc/oratab | grep -v "^#" | grep ${ORACLE_SID} | cut -d: -f2`
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib
#Export the oracle home, sid and library
#export ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH
echo "Your ORACLE HOME is set as ${ORACLE_HOME}"
echo "Your ORACLE DB is set as ${ORACLE_SID}"
~
===================
Please suggest how do I fix the issue/
Thanks-
p
|
|
|
|
|