bash_profile setting for different oracle versions installed in a single server.

vi /home/oracle/.bash_profile

umask 022
export ORACLE_BASE=/u01/app/oracle
export TNS_ADMIN=$ORACLE_BASE/product/11.2.0/db_1/network/admin

10g()
{       export ORACLE_SID=prim10g
        export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
        export PS1='[\u@\h\W]\$ '
}

11g()
{       export ORACLE_SID=prim11g
        export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
        export PS1='[\u@\h\W]\$ '
}

12c()
{       export ORACLE_SID=prim12c
        export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
        export PS1='[\u@\h\W]\$ '
}

--save and quit (:wq)

[oracle@server1 ~]$ . .bash_profile

Simply type "10g" to set 10g environment, "11g" for 12c, and so on.

No comments:

Post a Comment