linuxoracle-databaseoracle12ccentos5

Configure .bash_profile on linux (CENTOS) for multiple ORACLE HOMEs


I am using a server with CENTOS 5.11 and for different circumstances I need to use two versions of Oracle. I have already installed Oracle 10g successfully, however I want to install the 12c, in part to migrate my DB.

The problem is that I do not know how to configure the .bash_profile which is where the ORACLE_HOME is configured in the following way:

    ## Oracle Env Settings 
    export TMP=/tmp
    export TMPDIR=$TMP
    export ORACLE_HOSTNAME=oracle.localdomain
    export ORACLE_UNQNAME=MYDB  
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/VERSION/db_1
    export ORACLE_SID=MYDB
    export PATH=/usr/sbin:$PATH          
    export PATH=$ORACLE_HOME/bin:$PATH
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

I have searched and in the documentation of Oracle only mention that to install another version just need to install it in another ORACLE_HOME. So, my question is, how to add the new ORACLE_HOME in .bash_profile? and likewise if I can use the same users and groups for the new installation.


Solution

  • An excellent question! I stumbled upon the following:

    1. The Ask Tom's solution:

    In brief - use DBCA to configure the second installation (it will take care of those details for you and don't worry about the listener). This means that when you install the second DB, just store the files with the Universal Installer and then configure this with DBCA.

    1. This solution over here.

    In brief - use soft links for the ORACLE_SID and ORACLE_HOME. It's really a long tutorial, so there's no meaning to paste it here.

    1. My personal favorite - Go over Point1 :-).

    Now seriously - if you need to make it only through the .bash_profile, just put some if statements in it or create some external scripts for the different databases and just source them, or make .bash_profile call them, when you source it.

    To wrap it all up - always "install" the database by just storing the files, don't trust the installer. After deployment, run DBCA to configure the installation. In all cases it should take care of these configurations for you. In some cases, if not all, DBCA will actually set the same ORACLE_HOME and ORACLE_SID for both, but they will have different unique names, which you'll use to connect with sqlplus to start/stop them. As far as I see - all the solutions gravitate around the same thing I just mention in the paragraph above.

    Cheers