日期:2014-05-16 浏览次数:20578 次
#!/bin/bash # functions: This file contain some system and oracle configure preparing from oracle install. # author: huangxw 2010.8.16 ##################################### ### 1. Create User and group ##################################### /usr/sbin/groupadd oinstall /usr/sbin/groupadd dba if [ -z "$(id oracle &> /dev/null)" ]; then /usr/sbin/useradd -g oinstall -G dba oracle else /usr/sbin/usermod -g oinstall -G dba oracle fi echo "oracle" | passwd --stdin oracle ##################################### ### 2. Make direction ##################################### mkdir -p /u01/app/oracle/product/10.2.0/db_1 mkdir -p /u01/app/oracle/oraInventory mkdir -p /u01/app/oracle/oradata mkdir -p /u01/app/oracle/flash_recovery_area chown -R oracle:oinstall /u01/app/oracle chmod -R 775 /u01/app/oracle ##################################### ### 3. Configure system ### 3.1 /etc/sysctl.conf ##################################### # 536870912 1073741824 parastr=( "kernel.shmall=2097152" "kernel.shmmax=1073741824" "kernel.shmmni=4096" "kernel.sem=250 32000 100 128" "fs.file-max=65536" "net.ipv4.ip_local_port_range=1024 65000" "net.core.rmem_default=262144" "net.core.rmem_max=262144" "net.core.wmem_default=262144" "net.core.wmem_max=262144" ) if [ -z "$(grep "\# Added for Oracle" /etc/sysctl.conf)" ]; then echo "" >> /etc/sysctl.conf echo "# Added for Oracle" >> /etc/sysctl.conf echo "" >> /etc/sysctl.conf size=${#parastr[@]}; for ((i=0;i<$size;i++)) do eval tmp=\${parastr[i][@]} echo $tmp >> /etc/sysctl.conf done fi # take affect after restart /sbin/sysctl -p ##################################### ### 3. Configure system ### 3.2 /etc/redhat-release ##################################### echo "Red Hat Enterprise Linux Server release 4 (Tikanga)" > /etc/redhat-release ##################################### ### 3. Configure system ### 3.3 /etc/pam.d/login ##################################### if [ -z "$(grep "\# Added for Oracle" /etc/security/limits.conf)" ]; then echo "" >> /etc/security/limits.conf echo "# Added for Oracle" >> /etc/security/limits.conf echo "" >> /etc/security/limits.conf 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 ##################################### ### 3. Configure system ### 3.4 /etc/pam.d/login ##################################### [ -z "$(grep "session required /lib/security/pam_limits.so" /etc/security/limits.conf)" ] && echo "session required /lib/security/pam_limits.so" >> /etc/pam.d/login [ -z "$(grep "session required pam_limits.so" /etc/security/limits.conf)" ] && echo "session required pam_limits.so" >> /etc/pam.d/login ##################################### ### 3. Configure system ### 3.5 /etc/selinux/config ##################################### sed -i 's/^SELINUXTYPE=targeted/SELINUXTYPE=disabled/g' /etc/selinux/config ##################################### ### 4. Configure oracle ##################################### parastr=( 'export ORACLE_BASE=/u01/app/oracle' 'export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1' 'export ORACLE_SID=orcl' 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib' 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/X11R6/lib' 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/jdk/jre/lib/i386' 'export