Quantcast
Channel: Sameer Shaik. B.E,M.S,M.B.A,P.M.P,C.S.M
Viewing all articles
Browse latest Browse all 193

Setting up the oracle environment

$
0
0
I have three Oracle databases and each have its own environment that needs to be run.

Ex:-

1.ORCL
2.PROD1
3.GRID

Wrote a small crude shell script to run the env files.

[oracle@collabn1 ~]$ vi setup_ora_env.sh

#!/bin/bash
function unset1
{
echo "You are in func"
unset ORACLE_SID ORACLE_BASE TNS_ADMIN ORACLE_HOME
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin
}

k=1
echo -e "\n"
echo -e "You have below ENV files..."
array1=( $(ls ~/*.env) )
for i in "${array1[@]}";do
echo "Select $k for $i"
let "k=$k+1"
done
echo -e "\n"

#Unsetting the ORA ENV variables
unset1

echo -e "Enter your choince now:        "
read input
if [ $input -eq 1 ];then
echo -e "\n"
echo -e "Running environment file...   ${array1[0]}"
. ${array1[0]}
elif [ $input -eq 2 ];then
echo -e "\n"
echo -e "Running environment file...    ${array1[1]}"
.  ${array1[1]}
elif [ $input -eq 3 ];then
echo -e "\n"
echo -e "Running environment file...    ${array1[2]}"
. ${array1[2]}
else
echo -e "Wrong choice...Plz try again"
fi

Viewing all articles
Browse latest Browse all 193

Trending Articles