#!/bin/bash
yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl sysstat libXp unixODBC unixODBC-devel
groupadd oinstall;
groupadd dba;
groupadd oper;
useradd -g oinstall -G dba,oper oracle; 
echo "oracle"|passwd oracle --stdin
cat >>/etc/sysctl.conf<<EOF
fs.file-max = 6815744
fs.aio_max_nr=1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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 = 1048576
EOF
sysctl -p
cat >>/etc/security/limits.conf<<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF
cat >>/etc/pam.d/login<<EOF
session required pam_limits.so
EOF
cat >>/etc/profile<<EOF
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi
EOF
setenforce 0
mkdir /opt/oracle;
chown oracle:oinstall /opt/oracle;
chmod 755 /opt/oracle;
mkdir /opt/oraInventory;
chown oracle:oinstall /opt/oraInventory;
chmod 755 /opt/oraInventory;
