Multiple Homes and Instances Oracle Database Bash Profile


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
export CATALINA_HOME=/home/oracle/apache-tomcat
PATH=/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/bin/bash:$CATALINA_HOME/bin.
export PATH
EDITOR=vi
export EDITOR=vi

if [ -s "$MAIL" ] # This is at Shell startup. In normal
then echo "$MAILMSG" # operation, the Shell checks
fi # periodically.

echo " "
echo " "
echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " Database options"
echo " "
echo " "
echo " 1) DATABASE 12cR2"
echo " "
echo " 2) DATABASE 12cR1"
echo " "
echo " "
echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " "
echo " "
echo " Enter Choice:\c"
read env
if [ $env -eq 1 ] ; then
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=ora12cr2
PS1='$PWD:12cR2-->'

else
if [ $env -eq 2 ] ; then
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=ora12cr1
PS1='$PWD:12cR1-->'
fi
fi
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
export LIBPATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib:/lib
export PATH=$PATH:$ORACLE_HOME/bin:/u01/app/12.1.0.2/grid/bin:$ORACLE_HOME/OPatch
stty erase ^?
TMOUT=0;TIMEOUT=600;export readonly TMOUT TIMEOUT
set -o vi

echo ''
echo ''
clear
echo
echo "ORACLE_SID=$ORACLE_SID"
echo

alias tsmd='cd /opt/tivoli/tsm/client/oracle/bin64/'
alias ob='cd $ORACLE_BASE'
alias oh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias ch='cd $CATALINA_HOME'
alias envo='env | grep ORACLE'
alias sqld='rlwrap sqlplus "/as sysdba"'
export PATH
umask 022

envo

Leave a Reply