骑士注册 登录
Linux 中国◆开源社区 返回首页

7th的个人空间 https://linux.cn/space/10161 [收藏] [复制] [分享] [RSS]

日志

RHEL6安装oracle10g

热度 1已有 3026 次阅读2013-02-25 21:01 |个人分类:LINUX记录

#!/bin/sh
#####Author:J_alright
#####prepare for install oracle
v_date=$(date +%Y%m%d%H%M%S)
###create user and group
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba,root -c "oracle" -d /home/oracle oracle
echo "The user and group are created!!!"
#####set the environment
mv /home/oracle/.bash_profile /home/oracle/bash_profile_bak${v_date}
echo "if [ -f ~/.bashrc ]; then" >> /home/oracle/.bash_profile
echo " . ~/.bashrc" >> /home/oracle/.bash_profile
echo "fi" >> /home/oracle/.bash_profile
echo " " >> /home/oracle/.bash_profile
echo " " >> /home/oracle/.bash_profile
echo "oracle" | passwd --stdin oracle
echo "export ORACLE_BASE=/u01/app/oracle" >> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1' >> /home/oracle/.bash_profile
echo "export ORACLE_SID=orcl" >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/X11R6/lib' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/jdk/jre/lib/i386' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/jdk/jre/lib/i386/server' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/rdbms/lib' >> /home/oracle/.bash_profile
echo 'export CLASS_PATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib' >> /home/oracle/.bash_profile
echo 'export CLASS_PATH=$CLASS_PATH:$ORACLE_HOME/rdbms/jlib' >> /home/oracle/.bash_profile
echo 'export CLASS_PATH=$CLASS_PATH:$ORACLE_HOME/network/jlib' >> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm" >> /home/oracle/.bash_profile
echo "export EDITOR=vi" >> /home/oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile

echo "The environment is modified!!!"
######set the release
mv /etc/redhat-release /etc/redhat-release_bak
echo "Red Hat Enterprise Linux Server release 4 (Santiago)" >/etc/redhat-release
#####create files
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chown oracle:oinstall /home/oracle
#####limit the oracle process
echo "dir make"
#v_limit=$(grep 65536/etc/security/limits.conf)
#if [ $v_limit == '' ]
#then
#cp /etc/security/limits.conf /etc/security/limits.conf.bak${v_date}
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
#fi
echo "/etc/security/limits.conf had modified."

v_pam=$( grep pam_limits.so /etc/pam.d/login )
if [ "$v_pam" == '' ]
then
cp /etc/pam.d/login /etc/pam.d/login.bak${v_date}
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
echo "session required pam_limits.so" >>/etc/pam.d/login
fi
echo "/etc/pam.d/login had modified."

v_profile=$( grep 'ulimit -n 65536' /etc/profile )
if [ "$v_profile" == '' ]
then
cp /etc/profile /etc/profile.bak${v_date}
echo 'if [ $USER = "oracle" ]; then' >> /etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo 'ulimit -p 16384' >> /etc/profile
echo 'ulimit -n 65536' >> /etc/profile
echo 'else' >> /etc/profile
echo 'ulimit -u 16384 -n 65536' >> /etc/profile
echo 'fi' >> /etc/profile
echo 'fi' >> /etc/profile
fi
echo "/etc/profile had modified."
v_sysctl=$( grep net.core.rmem_max /etc/sysctl.conf )
if [ "$v_sysctl" == '' ]
then
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "fs.file-max = 65536" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
echo "net.core.rmem_default=1048576" >> /etc/sysctl.conf
echo "net.core.rmem_max=262144" >> /etc/sysctl.conf
echo "net.core.wmem_default=262144" >> /etc/sysctl.conf
echo "net.core.wmem_max=262144" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf

temp_id=`cat /etc/group | grep dba | cut -d ':' -f 3`
echo "vm.hugetlb_shm_group=${temp_id}" >> /etc/sysctl.conf

echo "Modifing the /etc/sysctl.conf has been succeed."
echo "Now make the changes take effect....."
sysctl -p
fi
echo "/etc/sysctl.conf had modified."
####install all required packages.
yum -y install libXp*
yum -y install libXp-devel*
yum -y install openmotif*
yum -y install openmotif-devel*
yum -y install gcc*
yum -y install libaio*
yum -y install libaio-devel*
yum -y install make*
yum -y install glibc*
yum -y install glibc-*.i686
yum -y install compat-libstdc++*
yum -y install compat-db*
yum -y install compat-gcc*
rpm -q gcc make binutils openmotif
yum -y install libXp.i686
yum -y install libXt.i686
yum -y install libXtst.i686 libXtst.x86_64
yum -y install make.x86_64
yum -y install gcc.x86_64
yum -y install binutils.x86_64
yum -y install libaio.i686
yum -y install compat-libstdc++*.i686 compat-libstdc++*.i686 compat-libstdc++*.x86_64
yum -y install compat*
yum -y groupinstall "Chinese Support"
yum -y install cjkuni-fonts* xorg-x11-fonts*
yum -y install glibc.i686
yum -y install zlib-devel
yum -y install mtx
yum -y install mt-st
yum -y install lsscsi
yum -y install sg3_utils
yum -y install ncompress
echo "OK!"



转载请注明出处http://www.itcai.info

返回顶部

分享到微信

打开微信,点击顶部的“╋”,
使用“扫一扫”将网页分享至微信。