http://www.dba-oracle.com/t_linux_profile_alias_change_oracle_database.htm
Many folks do not like to use the "oraenv" script to change Oracle environments, and some Oracle professionals write a Linux login script to perform the same task.
The script resides in the Linux users "profile" (i.e. .profile, .cshrc), and it build an alias with the same name as each $ORACLE_SID.
Once in-place, this alternative to oraenv allows you to change database environments by entering the ORACLE_SID name:
for DB in `cat /etc/oratab|grep -v \#|grep -v \*|cut -d":" -f1`
do
alias $DB='export ORAENV_ASK=NO; \
export ORACLE_SID='$DB';\
. $TEMPHOME/bin/oraenv; \
export ORACLE_HOME;\
export ORACLE_BASE=\
`echo $ORACLE_HOME | sed -e 's:/product/.*::g'`;\
export DBA=$ORACLE_BASE/admin;\
export SCRIPT_HOME=$DBA/scripts;\
export PATH=$PATH:$SCRIPT_HOME;\
export LIB_PATH=$ORACLE_HOME/lib64:$ORACLE_HOME/lib '
done
Now, simply enter the ORACLE_SID as a UNIX alias, and the alias will set your Oracle environment.
No Comments