Home » Infrastructure » Unix » how to setup bashprofile for multiple oracle homes
how to setup bashprofile for multiple oracle homes [message #305044] Fri, 07 March 2008 15:39 Go to next message
geeklol
Messages: 59
Registered: March 2005
Member
how to setup bashprofile for multiple oracle homes on the same host (sun solaris). lcecqa04 is 9i and lcecqa05 is 10g instances.
This is causing a lot of problems, because the cron jobs are now not running. I upgraded lcecqa05 from 9i to 10g recently.

----------------------------------------------------------

When i run the 9i profile, it works well,
qa5s90db01> . .bash_profile
which ORACLE_SID?
1 - lcecqa04
2 - qa5upgd
1
ORACLE_SID set to lcecqa04
qa5s90db01> sqlplus /nolog

SQL*Plus: Release 9.2.0.6.0 - Production on Fri Mar 7 13:27:15 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect / as sysdba
Connected.
SQL> select instance_name from v$instance;

INSTANCE_NAME
------------
lcecqa04

SQL> exit
----------------------------------------------------------
When i run my 10g profile, it goes to the 9.2. version of oracle.

qa5s90db01> . .bash_profile_10
ORACLE_SID set to lcecqa05
qa5s90db01> sqlplus /nolog

Message 133 not found; product=SQLPlus; facility=SP2
: Release 9.2.0.6.0 - Production on Fri Mar 7 13:27:45 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[/<password>][@<connect_identifier>] | /
Enter user-name:
----------------------------------------------------------

[B]If i force the 10g version of sqlplus then it DOES NOT CONNECT TO THE CORRECT INSTANCE, it thinks the instance is not up but it is when i do ps-ef|grep pmon.[/B]
qa5s90db01> echo $ORACLE_SID
lcecqa05
qa5s90db01> export ORACLE_HOME=/usr/local/oracle/10.2.0/
qa5s90db01> cd $ORACLE_HOME/bin
qa5s90db01> ./sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 7 13:32:54 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> connect /as sysdba
Connected to an idle instance.

----

qa5s90db01> ps -ef|grep pmon
root 312 1 0 Mar 06 ? 0:00 /usr/sbin/sparcv9/ipmon -Ds
oracle 401 1 0 Mar 06 ? 0:00 ora_pmon_lcecqa04
oracle 570 1 0 Mar 06 ? 0:05 ora_pmon_lcecqa05
oracle 16749 11826 0 13:33:23 pts/2 0:00 grep pmon

--------------------------------------------------
9i .bash_profile:ORACLE_HOME=/usr/local/oracle/9.2.0
export ORACLE_HOME

PATH=${PATH}:${ORACLE_HOME}/bin

export PS1='${PWD}> '

SID_CHOICE=0

while [ $SID_CHOICE -lt 1 ] || [ $SID_CHOICE -gt 2 ]
do
echo "which ORACLE_SID?"
echo "1 - lcecqa04 "
echo "2 - qa5upgd"
read SID_CHOICE
done

if [ $SID_CHOICE -eq 1 ]; then
ORACLE_SID=lcecqa04
ORACLE_BASE=/usr/local/oracle/admin/kbankqa
CREATE=/usr/local/oracle/admin/kbankqa/create; export CREATE
elif [ $SID_CHOICE -eq 2 ]; then
ORACLE_SID=qa5upgd
fi

export ORACLE_SID

echo "ORACLE_SID set to $ORACLE_SID"

PS1="`hostname`> "
export PS1

--------------------------------------------------
10g .bash_profile:
ORACLE_HOME=/usr/local/oracle/10.2.0
export ORACLE_HOME

PATH=${PATH}:${ORACLE_HOME}/bin

export PS1='${PWD}> '

SID_CHOICE=0

ORACLE_SID=lcecqa05
ORACLE_BASE=/usr/local/oracle/admin/lcecqa05

export ORACLE_SID

echo "ORACLE_SID set to $ORACLE_SID"

PS1="`hostname`> "
export PS1
--------------------------------------------------

my .oraenv looks like,
ORACLE_SID=lcecqa05
export ORACLE_SID

ORACLE_HOME=/usr/local/oracle/10.2.0
export ORACLE_HOME

PATH=$PATH:${ORACLE_HOME}/bin:
Re: how to setup bashprofile for multiple oracle homes [message #305052 is a reply to message #305044] Fri, 07 March 2008 17:40 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
When I have multiple databases or multiple versions, I create multiple *env files; one per ORACLE_SID.

After they exist, just source in the 1 you want/need.

[Updated on: Fri, 07 March 2008 17:40] by Moderator

Report message to a moderator

Previous Topic: UNIX
Next Topic: Date function
Goto Forum:
  


Current Time: Sun Nov 24 23:07:50 CST 2024