check="n"
echo -n "5. Oracle Install Configure ? [y/n] Default [n] : "
read check
if [ $check = "y" ];then
groupadd -g 777 dba
useradd -u 777 -g 777 -d /orahome oracle
useradd -u 778 -g 777 -d /oragrid oragrid
echo oracle | passwd --stdin oracle
echo oragrid | passwd --stdin oragrid
if [ -d /orahome ];then
cp -afp /etc/skel/.bashrc /orahome
cp -afp /etc/skel/.bash_profile /orahome
chown oracle:dba /orahome -R
chmod 755 /orahome -R
fi
if [ -d /oragrid ];then
cp -afp /etc/skel/.bashrc /oragrid
cp -afp /etc/skel/.bash_profile /oragrid
chown oragrid:dba /oragrid -R
chmod 755 /orahome -R
fi
sed -i 's/kernel.shmmax/\#kernel.shmmax/g' /etc/sysctl.conf
sed -i 's/kernel.shmall/\#kernel.shmall/g' /etc/sysctl.conf
memory_kb=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
memory_size=`echo "$memory_kb * 1024"| bc`
shmmax=`echo "$memory_size * 0.5"|bc |cut -d . -f 1`
shmall=`echo "$memory_size / 4"|bc|cut -d . -f 1`
cat << EOF >> /etc/sysctl.conf
kernel.shmmax = $shmmax
kernel.shmall = $shmall
fs.aio-max-nr = 4194304
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
EOF
cat << EOF >> /etc/security/limits.conf
oragrid soft nproc 2047
oragrid hard nproc 16384
oragrid soft nofile 1024
oragrid hard nofile 65536
oragrid soft stack 10240
oragrid hard stack 32768
oragrid soft memlock 262144000
oragrid hard memlock 262144000
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 262144000
oracle hard memlock 262144000
EOF
rpm -ivh /tmp/oracle_rpm/kmod-oracleasm-2.0.6.rh1-3.el6_5.x86_64.rpm /tmp/oracle_rpm/oracleasmlib-2.0.4-1.el6.x86_64.rpm /tmp/oracle_rpm/oracleasm-support-2.1.8-1.el6.x86_64.rpm
mv /tmp/java/ /usr/local/java/
mv /usr/bin/java /usr/bin/java_bak
mv /usr/bin/javac /usr/bin/javac_bak
cat << EOF >> /etc/profile
export PATH=\$PATH:/usr/local/java/bin
export JAVA_HOME=/usr/local/java
EOF
source /etc/profile
fi