Home » Infrastructure » Unix » Not able to export ORACLE_SID and ORACLE_HOME (HP-UX oracle 10g)
Not able to export ORACLE_SID and ORACLE_HOME [message #544557] Wed, 22 February 2012 07:31 Go to next message
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
Re: Not able to export ORACLE_SID and ORACLE_HOME [message #544559 is a reply to message #544557] Wed, 22 February 2012 07:42 Go to previous messageGo to next message
Michel Cadot
Messages: 59105
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Just use oraenv to set the environment for an ORACLE_SID.
Do not rewrite something that is already written.

Regards
Michel
Re: Not able to export ORACLE_SID and ORACLE_HOME [message #544563 is a reply to message #544559] Wed, 22 February 2012 09:09 Go to previous message
LKBrwn_DBA
Messages: 433
Registered: July 2003
Location: WPB, FL
Senior Member
Michel Cadot wrote
...Do not rewrite something that is already written.

Amen brother Michel...

Here is an example of how easy it is to code what Michel suggests:

#...Etc...
ORACLE_SID=${option}
ORAENV_ASK=NO
. /usr/local/bin/oraenv
ORAENV_ASK=YES
#...Etc...


[Updated on: Wed, 22 February 2012 10:18] by Moderator

Report message to a moderator

Previous Topic: Passing Parameter from unix to plsql
Next Topic: Context Switches and System Calls in HP-UX
Goto Forum:
  


Current Time: Wed Sep 17 06:39:26 CDT 2014

Total time taken to generate the page: 0.13378 seconds