Chinaunix首页 | 论坛 | 博客
  • 博客访问: 430998
  • 博文数量: 11
  • 博客积分: 3030
  • 博客等级: 中校
  • 技术积分: 1405
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-10 17:02
文章分类

全部博文(11)

文章存档

2011年(2)

2010年(4)

2008年(5)

我的朋友

分类: Oracle

2010-08-03 17:32:05

ORACLE 10G 安装前若要有些前期的配置,包括系统参数、文件修改、用户与组的创建等,使用该脚本可一步反位,不过运行该脚本前要根据你的硬件配置修改相应的值,看说明即可。
--------------------------------------------------------------------------------
#! /bin/bash
#################################################
#this script is run befor install oracle as root
#the default ORACLE_SID is orcl,if you want use other instance name you need to change the parameter in this file
before run it.
#this script only use in Linux system
#make sure the /u01 directory have created before run it
#################################################
echo "this script set the parameter auto for install oracle"
sleep 5
echo "config the kernel parameter file /etc/sysctl.conf."
echo net.ipv4.ip_forward = 0 >>/etc/sysctl.conf
echo net.ipv4.conf.default.rp_filter = 1 >>/etc/sysctl.conf
echo net.ipv4.conf.default.accept_source_route = 0 >>/etc/sysctl.conf
echo kernel.sysrq = 0 >>/etc/sysctl.conf
echo kernel.core_uses_pid = 1 >>/etc/sysctl.conf
echo net.ipv4.tcp_syncookies = 1 >>/etc/sysctl.conf
echo kernel.msgmnb = 65536 >>/etc/sysctl.conf
echo kernel.msgmax = 65536 >>/etc/sysctl.conf
echo kernel.shmmax = 2147483648 >>/etc/sysctl.conf
echo kernel.shmall = 2147483648 >>/etc/sysctl.conf
echo kernel.sem = 250   32000   128     128 >>/etc/sysctl.conf
echo net.ipv4.tcp_rmem = 4096 4194304 4194304 >>/etc/sysctl.conf
echo net.ipv4.tcp_wmem = 98304 4194304 4194304 >>/etc/sysctl.conf
echo net.core.rmem_default = 65535 >>/etc/sysctl.conf
echo net.core.wmem_default = 65535 >>/etc/sysctl.conf
echo net.core.rmem_max = 4194304 >>/etc/sysctl.conf
echo net.core.wmem_max = 4194304 >>/etc/sysctl.conf
echo net.ipv4.tcp_window_scaling = 1 >>/etc/sysctl.conf
echo net.ipv4.tcp_rmem = 4096 4194304 4194304 >>/etc/sysctl.conf
echo net.ipv4.tcp_wmem = 98304 4194304 4194304 >>/etc/sysctl.conf
echo net.core.rmem_default = 262144 >>/etc/sysctl.conf
echo net.core.wmem_default = 262144 >>/etc/sysctl.conf
echo net.core.rmem_max = 4194304 >>/etc/sysctl.conf
echo net.core.wmem_max = 4194304 >>/etc/sysctl.conf
echo net.ipv4.tcp_window_scaling  >>/etc/sysctl.conf= 1
echo net.ipv4.ip_local_port_range = 1024 65000 >>/etc/sysctl.conf
sysctl -p
sleep 5
echo "config the file /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
sleep 5
echo "config the file /etc/pam.d/login"
echo session required pam_limits.so >> /etc/pam.d/login
sleep 5
echo "cofnig the file /etc/profile"
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
sleep 5
echo "disable the firewall service and stop it"
chkconfig --level 2345 iptables off
service iptables stop
echo "create the user and group of oracle,oinstall,dba"
export a=`cat /etc/group|grep oinstall|wc -l`
export b=`cat /etc/group|grep dba|wc -l`
export c=`cat /etc/passwd|grep oracle|wc -l`
 
if [ $a == 1 ];then
        echo "the group OINSTALL exist"
                else
                echo "create group OINSTALL:"
                groupadd -g 502 oinstall
fi
sleep 5
if [ $b == 1 ];then
        echo "the group DBA exist"
                else
                echo "create group DBA:"
                groupadd -g 503 dba
fi
sleep 5
if [ $c == 1 ];then
        echo "the user ORACLE exist"
                else
                echo "create user ORACLE:"
                useradd -u 502 -g oinstall -G dba -d /u01/oracle/ -s /bin/bash oracle
                passwd oracle
fi
sleep 5
echo "create the directory for oracle"
mkdir -p /u01/oracle/proeuct/10.2.0/db_1
chown -R oracle:oinstall /u01/oracle
chmod -R 755 /u01/oracle
echo "config the oracle parameter file"
echo "export ORACLE_BASE=/u01/oracle" >>/u01/oracle/.bash_profile
echo "export ORACLE_HOME=\$ORACLE_BASE/product/10.2.0/db_1" >>/u01/oracle/.bash_profile
echo "export ORACLE_PATH=\$ORACLE_BASE/common/oracle/sql:.:\$ORACLE_HOME/rdbms/admin" >>/u01/oracle/.bash_profile
export c=`cat /etc/passwd|grep oracle|wc -l`
 
if [ $a == 1 ];then
        echo "the group OINSTALL exist"
                else
                echo "create group OINSTALL:"
                groupadd -g 502 oinstall
fi
sleep 5
if [ $b == 1 ];then
        echo "the group DBA exist"
                else
                echo "create group DBA:"
                groupadd -g 503 dba
fi
sleep 5
if [ $c == 1 ];then
        echo "the user ORACLE exist"
                else
                echo "create user ORACLE:"
                useradd -u 502 -g oinstall -G dba -d /u01/oracle/ -s /bin/bash oracle
                passwd oracle
fi
sleep 5
echo "create the directory for oracle"
mkdir -p /u01/oracle/proeuct/10.2.0/db_1
chown -R oracle:oinstall /u01/oracle
chmod -R 755 /u01/oracle
echo "config the oracle parameter file"
echo "export ORACLE_BASE=/u01/oracle" >>/u01/oracle/.bash_profile
echo "export ORACLE_HOME=\$ORACLE_BASE/product/10.2.0/db_1" >>/u01/oracle/.bash_profile
echo "export ORACLE_PATH=\$ORACLE_BASE/common/oracle/sql:.:\$ORACLE_HOME/rdbms/admin" >>/u01/oracle/.bash_profile
echo "export ORACLE_SID=orcl" >>/u01/oracle/.bash_profile
echo "export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK" >>/u01/oracle/.bash_profile
echo "export PATH=.:\$ORACLE_HOME/bin:${PATH}:\$HOME/bin" >>/u01/oracle/.bash_profile
echo "export PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin:\$ORA_CRS_HOME/bin" >>/u01/oracle/.bash_profi
le
echo "export PATH=\${PATH}:\$ORACLE_BASE/common/oracle/bin" >>/u01/oracle/.bash_profile
echo "export ORACLE_TERM=xterm" >>/u01/oracle/.bash_profile
echo "export TNS_ADMIN=\$ORACLE_HOME/network/admin" >>/u01/oracle/.bash_profile
echo "export ORA_NLS10=\$ORACLE_HOME/nls/data" >>/u01/oracle/.bash_profile
echo "export LD_LIBRARY_PATH=\$ORACLE_HOME/lib" >>/u01/oracle/.bash_profile
echo "export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib" >>/u01/oracle/.bash_profile
echo "export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib" >>/u01/oracle/.bash_profile
echo "export CLASSPATH=\$ORACLE_HOME/JRE" >>/u01/oracle/.bash_profile
echo "export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib" >>/u01/oracle/.bash_profile
echo "export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib" >>/u01/oracle/.bash_profile
echo "export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib" >>/u01/oracle/.bash_profile
echo "export TEMP=/tmp" >>/u01/oracle/.bash_profile
echo "export TMPDIR=/tmp" >>/u01/oracle/.bash_profile
sleep 5
 
阅读(700) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~