Monday, December 28, 2009

Set Environment Variable for Multiple Databases

You can use the below method to Set Environment Variable for Multiple Databases.

Step 1: Edit the .profile with the following information.
########## --Script starts Here -- ###############
print
print "Available SIDs to choose from:"
cat /var/opt/oracle/oratab | grep -v ^#
print
#Set Oracle SID
export ORACLE_SID=testdb -- enter the SID which you connect very often. Only one SID is enough

TERM=vt220; export TERM
. $HOME/.All_Profile
export ORACLE_TERM=vt100;
stty erase ^h
#stty erase ^?
EDITOR=vi; export $EDITOR
set -o vi
########## --Script Ends Here -- ###############

Step 2: Create .All_Profile with the following information.

########## --Script starts Here -- ###############
ORAENV_ASK=YES
export ORAENV_ASK
#To Set ORACLE Base
export ORACLE_BASE=/export/home/oracle1
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

#Set Oracle SID
export ORACLE_SID=testdb -- enter the SID which you connect very ofte. Only one SID is enough
#Set PATH to executable directories
PATH=:$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/sbin:/usr/lib:/bin
export PATH
. oraenv
#Set PATH for LD_LIBRARY PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
# Set Oracle user umask
umask 022
# Ensure that TWO_TASK is not set
unset TWO_TASK
# Ensure that CLASS_PATH is not set
unset CLASS_PATH

export ORACLE_PATH=$HOME
########## --Script Ends Here -- ###############

Step 3: Logout the session and Login again.

Above steps I tested in Solaris Environment.

No comments: