Oracle/Database/Oracle Power Install Script (Oracle 11g - RHEL 5)

From Omnia
Jump to navigation Jump to search
####################################################
#             ORACLE POWER                         #
#    ORACLE 11g with RHEL 5 Power Installer        #
#         Written and maintained by                #
#  Kenneth Burgener <kenneth@oeey.com>             #
####################################################


echo "=== ORACLE POWER ==="
echo ""
echo -n "Srini, are you ready to be amazed? [Y]: "
read srini
if [ -z $srini -o $srini = "Y" -o $srini = "y" ] ; then
  echo ""
else
  echo "Tough luck, here it comes!" 
fi

grep "Red Hat Enterprise Linux Server release 5" /etc/issue
if [ $? -ne 0 ] ; then
 echo "ERROR: This script is designed to run on RHEL 5!"
 exit 1
fi

if [ -e /etc/oraclepower ] ; then
  echo "ERROR: Oracle Power has already been executed!"
  exit 1
fi

touch /etc/oraclepower
if [ $? -ne 0 ] ; then
  echo "ERROR: Run Oracle Power as root!"
  exit 1
fi

##################################################
# configure hosts
cp /etc/hosts /etc/hosts.original
echo -e "127.0.0.1\t\tlocalhost.localdomain localhost" > /etc/hosts
echo -e "`ifconfig | grep "inet addr" | head -n 1 | cut -f 2 -d ":" | cut -f 1 -d " "`\t\t`hostname` `hostname | cut -f 1 -d '.'`" >> /etc/hosts


##################################################
# configure kernel parameters
cat >> /etc/sysctl.conf <<EOF

# Oracle Settings
#
# Only change default kernel.shmall and kernel.shmmax if pre-existing values
#   are lower then listed below:
# kernel.shmall = 2097152
# kernel.shmmax = 536870912
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
# memory settings
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144

EOF

/sbin/sysctl -p


##################################################
# Configure limits
cat >> /etc/security/limits.conf <<EOF


# Oracle Settings
*               soft    nproc   	2047
*               hard    nproc   	16384
*               soft    nofile  	1024
*               hard    nofile  	65536

EOF


##################################################
# Configure pam.d
cat >> /etc/pam.d/login <<EOF

# Oracle Settings
session    required     pam_limits.so

EOF


##################################################
# Configure Users and Groups
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
# give password to oracle user 'test12'
# passwd oracle
echo "test12" | passwd --stdin oracle


##################################################
# Create directories
mkdir -p /opt/oracle
chown -R oracle.oinstall /opt/oracle
mkdir /opt/oraInventory
chown -R oracle.oinstall /opt/oraInventory


##################################################
# Configure Oracle profile
cat >> /home/oracle/.bash_profile <<"EOF"

# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jdk/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi

EOF



##################################################
# Configure VNC Server
cat >> /etc/sysconfig/vncservers <<EOF

VNCSERVERS="1:oracle"
VNCSERVERARGS[2]="-geometry 1024x768"

EOF

mkdir -p /home/oracle/.vnc
echo "de2e2c59eda77881" | xxd -p -r - /home/oracle/.vnc/passwd
chmod 600 /home/oracle/.vnc/passwd
chown -R oracle:oinstall /home/oracle/.vnc

chkconfig vncserver on
service vncserver start

sed -i 's%# unset SESSION_MANAGER%unset SESSION_MANAGER%g' /home/oracle/.vnc/xstartup
sed -i 's%# exec /etc/X11/xinit/xinitrc%exec /etc/X11/xinit/xinitrc%g' /home/oracle/.vnc/xstartup
# restart vncserver to take effect:
service vncserver restart


##################################################
# ORACLE POWER
echo "Thank you for using..."
echo ""
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"
echo "ORACLE POWER!!!"

echo ""
echo "[you may know install Oracle]"
echo ""


####################################################
#             ORACLE POWER                         #
#    ORACLE 11g with RHEL 5 Power Installer        #
#         Written and maintained by                #
#  Kenneth Burgener <kenneth@oeey.com>             #
####################################################