When preparing your RHEL server for an Oracle RDBMS or other application software installations, it is common to have multiple oracle RDBMS instances or other related applications which share the same environmental variables, but with different values. This procedure shows how to setup your RHEL environment to support multiple Oracle software installs.
- Logon as the oracle software user.
- Go to the user’s home directory and edit the .bash_profile file with the following lines and placing the environmental variables for each database instance in the separate block.
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
# User specific environment and startup programs
echo “Choose the number associated with the SID you wish to administrate:”
echo ” 1 – ORCL”
echo ” 2 – MYDB”
read SID_NUMBER
if [ $SID_NUMBER = 1 ]; then
echo “SID Number is $SID_NUMBER”
<ENTER ENVIRONMENTAL Variables for instance 1 here>
elif [ $SID_NUMBER = 2 ]; then
echo “SID Number is $SID_NUMBER”
<ENTER ENVIRONMENTAL Varaibles for instance 2 here>
else
<Default environmental variables>
echo “Invalid SID Number, defaulting to $ORACLE_SID”
fi
- In our example the .bash_profile file looks like:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
echo “Choose the number associated with the SID you wish to administrate:”
echo ” 1 – ORCL”
echo ” 2 – MYDB”
read SID_NUMBER
if [ $SID_NUMBER = 1 ]; then
echo “SID Number is $SID_NUMBER”
export JAVAPATH=/usr/bin/java
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/ORCL_db
export ORACLE_SID=ORCL
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$JAVAPATH:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
umask 022
elif [ $SID_NUMBER = 2 ]; then
echo “SID Number is $SID_NUMBER”
export JAVAPATH=/usr/bin/java
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/MYDB_db
export ORACLE_SID=MYDB
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$JAVAPATH:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
umask 022
else
export JAVAPATH=/usr/bin/java
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/MYDB_db
export ORACLE_SID=MYDB
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$JAVAPATH:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
umask 022
echo “Invalid SID Number, Defaulting to $ORACLE_SID”
fi
- No logon as the oracle user and select the appropriate choose for your environment.
[root@MYLINUX ~]# su – oracle
Choose the number associated with the SID you wish to administrate:
1 – ORCL
2 – MYDB
1
SID Number is 1
[oracle@MYLINUX ~]$ exit
logout
[root@MYLINUX ~]# su – oracle
Choose the number associated with the SID you wish to administrate:
1 – ORCL
2 – MYDB
2
SID Number is 2
[oracle@MYLINUX ~]$ exit
logout
[root@MYLINUX ~]# su – oracle
Choose the number associated with the SID you wish to administrate:
1 – ORCL
2 – MYDB
5
Invalid SID Number, Defaulting to MYDB
[oracle@MYLINUX ~]$
- This completes creating multiple oracle environmental variables for a single Linux Server
Larry Catt, OCP