#!/bin/bash
sed -i '7s/enforcing/disabled/' /etc/selinux/config
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
iptables -F
/sbin/iptables-save
yum install -y binutils* compat-libstdc* elfutils-libelf* gcc* glibc* ksh* libaio* libgcc* libstdc* make* sysstat* libXp* glibc-kernheaders
groupadd -g 501 oinstall
groupadd -g 502 dba
useradd -u 502 -g oinstall -G dba oracle
ORACLE_HOME=/opt/app/oracle/product/11.2.0/dbhome_1
ORACLE_APP=`echo $ORACLE_HOME |awk -F'/' '{print "/"$2"/app"}'`
mkdir -p $ORACLE_HOME
chown -R oracle:oinstall $ORACLE_APP
let Mem_max=`free -m |awk '{print $2}'|sed -n '2p'`*1024*1024
let Mem_min=$Mem_max/10*8
cat>/etc/sysctl.conf<<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = $Mem_min
kernel.shmmax = $Mem_max
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
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
echo "oracle hard stack 10240">>/etc/security/limits.conf
echo "ORACLE_BASE=$ORACLE_APP/orecle">>/home/oracle/.bash_profile
echo "ORACLE_HOME=$ORACLE_HOME">>/home/oracle/.bash_profile
echo "ORACLE_SID=orcl">>/home/oracle/.bash_profile
echo "PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin">>/home/oracle/.bash_profile
echo "LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/user/lib">>/home/oracle/.bash_profile
echo "export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH">>/home/oracle/.bash_profile
source /home/oracle/.bash_profile
passwd oracle
本文出自 “运维笔记” 博客,请务必保留此出处http://quliren.blog.51cto.com/9849266/1974644