MENU FOR ORACLE DATABASE ON IBM AIX

oracle-11g-logo

When you have several databases in the same server using also the same user, it is common human errors because wrong Oracle environmental variables configuration. Then below has a script that you can put in .profile file of the user own of Oracle Database files on IBM AIX:

EDITOR=vi
export EDITOR

clear
echo “Please choose the instance number”
echo ” ”

cont=0
awk -F: ‘ ! /^#|^$|^*/ {print $1,$2}’ /etc/oratab |
while read par1 par2
do
cont=`expr $cont + 1`

inst[$cont]=$par1
orahome[$cont]=$par2

echo ”  [  $cont ]   ${inst[$cont]} ( ${orahome[$cont]} )”
done
echo ”  [ 99 ]   Don’t set any instance. ”
echo “”
opc=0
while [ $opc -lt 1 -o $opc -gt $cont ]
do
echo -n “Option: ” ; read opc
[ -z “$opc” ] && opc=0
[ -z “`echo 123456789910 | grep $opc`” ] && opc=0
[ $opc -eq 99 ] && break
done

#echo “nn”
if [ $opc -eq 99 ]
then
echo “! YOU DID NOT CHOSE ANY INSTANCE  !”
export ORACLE_SID=no_instance
else
export ORACLE_SID=${inst[$opc]}
export ORACLE_HOME=${orahome[$opc]}
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$ORACLE_HOME/bin:$PATH
if [ -f $ORACLE_HOME/.setenv ]
then
. $ORACLE_HOME/.setenv

fi
fi

echo $ORACLE_SID
set -o vi

kindregards

Related posts

Leave a Comment