首页 > 代码库 > RHEL-6.5_x86-64安装Oracle-11.0.2.4系统设置

RHEL-6.5_x86-64安装Oracle-11.0.2.4系统设置

1、系统kernel参数设置

cat >> /etc/sysctl.conf << "EOF"

##### for Oracle_11gR2 #####

fs.aio-max-nr = 1048576 
fs.file-max = 6815744 

# kernel.shmall=2097152   
# kernel.shmmax=4195057664
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

RHEL 6中shmall和shmmax已配置,使用默认设置即可,shmmax一般设为系统内存的一半,4195057664=4GB

修改之后执行命令生效:

/sbin/sysctl -p


2、修改用户限制

cat >> /etc/security/limits.conf << "EOF"

##### for Oracle_11gR2 #####
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

EOF

echo "session    required     pam_limits.so">>/etc/pam.d/login



3、修改系统配置文件

cat >> /etc/profile << "EOF"

##### for Oracle_11gR2 #####
if [ $USER = "oracle" ]; then 
    if [ $SHELL = "/bin/ksh" ]; then 
ulimit -p 16384 
ulimit -n 65536 
    else 
        ulimit -u 16384 -n 65536 
    fi 
fi
 
EOF


cat >> /etc/csh.login << "EOF"

##### for Oracle_11gR2 #####
if( $USER == "oracle" ) then 
    limit maxproc 16384 
    limit descriptors 65536 
    umask 022 
endif 

EOF


4、创建oracle用户,准备oracle安装目录

/usr/sbin/groupadd oinstall 
/usr/sbin/groupadd dba 
/usr/sbin/useradd -m -g oinstall -G dba oracle 
echo "oracle"|passwd --stdin oracle


mkdir -p /opt/oracle/ 
chown -R oracle:oinstall /opt/oracle/
chmod -R 775 /opt/oracle/  
mkdir -p /opt/oraInventory 
chown -R oracle:oinstall /opt/oraInventory
chmod -R 775 /opt/oraInventory


5、修改oracle用户配置文件

cat >> /home/oracle/.bash_profile << "EOF"

##### for Oracle_11gR2 #####
if [ $USER = "oracle" ]; then 
   if [ $SHELL = "/bin/ksh" ]; then 
     ulimit -p 16384 
     ulimit -n 65536 
   else 
     ulimit -u 16384 -n 65536 
   fi 
fi 

umask 022

export TMP=/tmp 
export TMPDIR=/tmp
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=$ORACLE_SID 
export ORACLE_TERM=xterm

export LANG=en_US.UTF8
export NLS_LANG=american_america.AL32UTF8
#export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/X11R6/lib:$ORACLE_HOME/rdbms/lib
export CLASS_PATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export PATH=$ORACLE_HOME/bin:$PATH

EOF


6、配置hosts文件

echo "192.168.0.10 oracle11g oracle11g.local" >> /etc/hosts


7、修改RHEL版本号,完成Oracle安装再修改回来

sed -i ‘/Red Hat Enterprise Linux Server release 6.5 (Santiago)/s/^/#/‘ /etc/redhat-release
sed -i ‘a Red Hat Enterprise Linux Server release 5.0 (Tikanga)‘ /etc/redhat-release


8、关闭SELinux、防火墙

sed -i ‘/SELINUX=enforcing/s/^/#/‘ /etc/selinux/config
sed -i ‘/#SELINUX=enforcing/a SELinux=disabled‘ /etc/selinux/config

防火墙通过RHEL图形化管理工具禁用,完成后重启系统