首页 > 代码库 > 单实例数据库安装脚本

单实例数据库安装脚本

安装脚本

1、1_preusers.sh 

#!/bin/bash#Purpose:Create 3 groups named oinstall,dba,oper, plus 1 users named oracle.#Also setting the Environment#variable for oracle user.#Usage:Log on as the superuser(root),and then execute the command:#./1preusers.sh#Author:Arcer Zhangecho "Now create 3 groups named ‘oinstall‘,‘dba‘,‘oper‘"echo "Plus 1 users named ‘oracle‘,Also setting the Environment"groupadd -g 1100 oinstallgroupadd -g 1200 dbagroupadd -g 1300 operuseradd -u 1000 -g oinstall -G dba,oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracleecho "oracle" | passwd --stdin oracleecho export PS1="`/bin/hostname -s`-> " >> /home/oracle/.bash_profileecho "export TMP=/tmp" >> /home/oracle/.bash_profileecho export TMPDIR=$TMP>>/home/oracle/.bash_profileecho "export ORACLE_HOSTNAME=olap.localdomain">> /home/oracle/.bash_profileecho "export ORACLE_SID=SOURCEDB">> /home/oracle/.bash_profileecho "export ORACLE_BASE=/u01/app/oracle">> /home/oracle/.bash_profileecho export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1>> /home/oracle/.bash_profileecho "export ORACLE_UNQNAME=SOURCEDB">> /home/oracle/.bash_profileecho export TNS_ADMIN=$ORACLE_HOME/network/admin >> /home/oracle/.bash_profileecho "export ORACLE_TERM=xterm">> /home/oracle/.bash_profileecho export PATH=/usr/sbin:$PATH>> /home/oracle/.bash_profileecho export PATH=$ORACLE_HOME/bin:$PATH>> /home/oracle/.bash_profileecho export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib>> /home/oracle/.bash_profileecho export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib >> /home/oracle/.bash_profileecho "export EDITOR=vi" >> /home/oracle/.bash_profileecho "export LANG=en_US" >> /home/oracle/.bash_profileecho "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profileecho "export NLS_DATE_FORMAT=‘yyyy/mm/dd hh24:mi:ss‘" >> /home/oracle/.bash_profileecho "export DISPLAY=192.168.56.101:0.0" >> /home/oracle/.bash_profileecho "umask 022">> /home/oracle/.bash_profileecho "The Groups and users has been created"echo "The Environment for oracle also has been set successfully"

2_predir.sh 

#!/bin/bash#Purpose:Create the necessary directory for oracle,grid users and change the authention to oracle,grid users.#Usage:Log on as the superuser(root),and then execute the command:#./2predir.sh#Author:Arcer Zhangecho "Now create the necessary directory for oracle users and changethe authention to oracle users..."mkdir -p /u01/app/oraclechown -R oracle:oinstall /u01chmod -R 775 /u01echo "The necessary directory for oracle,grid users and change the authention to oracle,grid users has been finished"

3_prelimits.sh 

#!/bin/bash#Purpose:Change the /etc/security/limits.conf.#Usage:Log on as the superuser(root),and then execute the command:#./3prelimits.sh#Author:Arcer Zhangecho "Now modify the /etc/security/limits.conf,but backup it named /etc/security/limits.conf.bak before"cp /etc/security/limits.conf /etc/security/limits.conf.bakecho "oracle soft nproc 2047" >>/etc/security/limits.confecho "oracle hard nproc 16384" >>/etc/security/limits.confecho "oracle soft nofile 1024" >>/etc/security/limits.confecho "oracle hard nofile 65536" >>/etc/security/limits.confecho "Modifing the /etc/security/limits.conf has been succeed."

 

4_prelogin.sh 

#!/bin/bash#Purpose:Modify the /etc/pam.d/login.#Usage:Log on as the superuser(root),and then execute the command:#./4prelimits.sh#Author:Arcer Zhangecho "Now modify the /etc/pam.d/login,but with a backup named /etc/pam.d/login.bak"cp /etc/pam.d/login /etc/pam.d/login.bakecho "session required /lib/security/pam_limits.so" >>/etc/pam.d/loginecho "session required pam_limits.so" >>/etc/pam.d/loginecho "Modifing the /etc/pam.d/login has been succeed."

5_preprofile.sh 

#!/bin/bash#Purpose:Modify the /etc/profile.#Usage:Log on as the superuser(root),and then execute the command:#./5preprofile.sh#Author:Arcer Zhangecho "Now modify the /etc/profile,but with a backup named /etc/profile.bak"cp /etc/profile /etc/profile.bakecho if [ $USER = "oracle" ]; then >> /etc/profileecho if [ $SHELL = "/bin/ksh" ]; then >> /etc/profileecho ulimit -p 16384 >> /etc/profileecho ulimit -n 65536 >> /etc/profileecho else >> /etc/profileecho ulimit -u 16384 -n 65536 >> /etc/profileecho fi >> /etc/profileecho fi >> /etc/profileecho "Modifing the /etc/profile has been succeed."

6_presysctl.sh 

#!/bin/bash#Purpose:Modify the /etc/sysctl.conf.#Usage:Log on as the superuser(root),and then execute the command:#./6presysctl.sh#Author:Arcer Zhangecho "Now modify the /etc/sysctl.conf,but with a backup named /etc/sysctl.bak"cp /etc/sysctl.conf /etc/sysctl.conf.bakecho "fs.aio-max-nr = 1048576" >> /etc/sysctl.confecho "fs.file-max = 6815744" >> /etc/sysctl.confecho "kernel.shmall = 2097152" >> /etc/sysctl.confecho "kernel.shmmax = 1054504960" >> /etc/sysctl.confecho "kernel.shmmni = 4096" >> /etc/sysctl.confecho "kernel.sem = 250 32000 100 128" >> /etc/sysctl.confecho "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.confecho "net.core.rmem_default = 262144" >> /etc/sysctl.confecho "net.core.rmem_max = 4194304" >> /etc/sysctl.confecho "net.core.wmem_default = 262144" >> /etc/sysctl.confecho "net.core.wmem_max = 1048586" >> /etc/sysctl.confecho "net.ipv4.tcp_wmem = 262144 262144 262144" >> /etc/sysctl.confecho "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.confecho "Modifing the /etc/sysctl.conf has been succeed."echo "Now make the changes take effect....."sysctl -p

 

 

 

 

相关参考文章

1、配置本地YUM源