#!/bin/bash
####################################################################################
# Description:此脚本为rhel5或rhel6环境安装oracle 10g的系统准备工作,需要配置好yum源                  
# 添加的oracle用户默认密码为oracle                                                                                          
# Author:snaid                                                              
# Email:[email protected]                                                      
####################################################################################
#difine oracle_sid
read -p "Please input your oracle sid that will be install:" ora_sid
#modify system version
echo "Red Hat Enterprise Linux Server release 4.8 (Tikanga)" > /etc/redhat-release
#install depdent packge
for i in binutils compat-gcc-34 compat-libstdc++-296 control-center gcc gcc-c++ glibc glibc-common glibc-devel libaio libgcc libstdc++ libstdc++-devel libXp
do
yum -y install $i 2>/dev/null ;
done
#modify kernel parameter
printf "kernel.shmall = 2097152 \n
kernel.shmmax = 2147483648 \n
kernel.shmmni = 4096 \n
kernel.sem = 250 32000 100 128 \n
fs.file-max = 65536 \n
net.ipv4.ip_local_port_range = 1024 65000 \n
net.core.rmem_default = 1048576 \n
net.core.rmem_max = 1048576 \n
net.core.wmem_default = 262144 \n
net.core.wmem_max = 262144 ">> /etc/sysctl.conf
/sbin/sysctl -p
#adduser
/usr/sbin/groupadd -g 1000 oinstall
/usr/sbin/groupadd -g 1001 dba
/usr/sbin/useradd -u 1000 -g oinstall -G dba oracle
echo "oracle"| passwd oracle --stdin > /dev/null 2>&1
#build oracle directory
mkdir -p /u01/oracle
chown -R oracle.oinstall /u01
#oracle environment variable
echo export ORACLE_BASE=/u01/oracle >> /home/oracle/.bash_profile
echo export ORACLE_HOME=\$ORACLE_BASE/product/10.2.0 >> /home/oracle/.bash_profile
echo export ORACLE_SID=$ora_sid >> /home/oracle/.bash_profile
echo export PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin >> /home/oracle/.bash_profile
echo export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib >> /home/oracle/.bash_profile
source /home/oracle/.bash_profile
#oracle's ulimit
printf
"oracle soft nproc 2047 \n
oracle hard nproc 16384 \n
oracle soft nofile 1024 \n
oracle hard nofile 65536 \n" >> /etc/security/limits.conf
echo "Please make sure your hostname and host file configure ok."