You are on page 1of 3

ARG_COUNT=$#

PWD=$1
DIR=$2
LOGFILE=$DIR/XEinstall.log
RES=$DIR/xe.rsp

if [ "${ARG_COUNT}" -ne 2 ]
then
echo ""
echo -e "\e[1;31m***ERROR: INCORRECT USAGE \e[0m -- Please
provide all the mandatory arguments for the script."
echo ""
echo -e "\t1) Password that you want to set for SYS & SYSTEM
User."
echo -e "\t2) Directory where you have downloaded the XE zip
eg:- /home/oracle"
echo ""
echo -e "\t sh XEinstall.sh Password /home/oracle"
echo ""
else
echo "Script execution started at `date`" > $LOGFILE
echo "1) Installing Dependent RPMs..." | tee -a $LOGFILE
yum install glibc make binutils gcc libaio bc flex -y
>>$LOGFILE
if [ $? = 0 ]; then
echo -e "\t RPMs installed successfully." |
tee -a $LOGFILE
else
echo -e "\t Error in installing the RPMs,
ensure script is executed as root & if yum is configured correctly."
| tee -a $LOGFILE
echo -e "\t Script Exiting, please check the
log file $LOGFILE..." | tee -a $LOGFILE
exit
fi
echo "2) Creating Response file for XE silent
installation..." | tee -a $LOGFILE
echo "ORACLE_HTTP_PORT=8080" >$RES
echo "ORACLE_LISTENER_PORT=1521" >>$RES
echo "ORACLE_PASSWORD=$PWD" >>$RES
echo "ORACLE_CONFIRM_PASSWORD=$PWD" >>$RES
ORACLE_DBENABLE=y >>$RES
echo -e "\t Response file created successfully $RES." | tee
-a $LOGFILE
cat $RES >>$LOGFILE
cd $DIR
echo "3) Unzipping the downloaded zipped file..." | tee -a
$LOGFILE
unzip $DIR/oracle-xe-11.2.0-1.0.x86_64.rpm.zip >>$LOGFILE
if [ $? = 0 ]; then
echo -e "\t File un-zipped successfully." |
tee -a $LOGFILE
else
echo -e "\t Error in un-zipping the file" |
tee -a $LOGFILE
echo -e "\t Script Exiting, please check the
log file $LOGFILE..." | tee -a $LOGFILE
exit
fi
echo "4) Installing XE..." | tee -a $LOGFILE
rpm -ivh $DIR/Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm
>>$LOGFILE
if [ $? = 0 ]; then
echo -e "\t XE Installed successfully." |
tee -a $LOGFILE
else
echo -e "\t Error in installing XE" | tee -a
$LOGFILE
echo -e "\t Script Exiting, please check the
log file $LOGFILE..." | tee -a $LOGFILE
exit
fi
echo "5) Configuring XE" | tee -a $LOGFILE
/etc/init.d/oracle-xe configure responseFIle=$RES >>$LOGFILE
if [ $? = 0 ]; then
echo -e "\t XE configured successfully." |
tee -a $LOGFILE
else
echo -e "\t Error in configuring the XE" |
tee -a $LOGFILE
echo -e "\t Script Exiting, please check the
log file $LOGFILE..." | tee -a $LOGFILE
exit
fi
echo . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
>>/u01/app/oracle/.bash_profile
echo ""
echo ""
echo "XE has been installed successfully."
echo "Switch to Oracle user to access the binaries."
fi

You might also like