1、preusers.sh脚本
#!/bin/bash #Purpose:Create6groupsnamed'oinstall','dba','asmadmin','asmdba','asmoper','oper',plus2usersnamed'oracle','grid'. #AlsosettingtheEnvironment #variablefororacleuser. #variableforgriduser. #Usage:logonasthesuperuser('root'),andthenexecutethecommand:#./1preusers.sh #Author:AsherHuang echo"Nowcreate6groupsnamed'oinstall','oper'" echo"Plus2usersnamed'oracle','grid',AlsosettingtheEnvironment" groupadd-g1000oinstall groupadd-g1200asmadmin groupadd-g1201asmdba groupadd-g1202asmoper useradd-u1100-goinstall-Gasmadmin,asmdba,asmoper-d/home/grid-s/bin/bash-c"gridInfrastructureOwner"grid echo"grid"|passwd--stdingrid echo'exportPS1="`/bin/hostname-s`->"'>>/home/grid/.bash_profile echo"exportTMP=/tmp">>/home/grid/.bash_profile echo'exportTMPDIR=$TMP'>>/home/grid/.bash_profile echo"exportORACLE_SID=+ASM1">>/home/grid/.bash_profile echo"exportORACLE_BASE=/u01/app/grid">>/home/grid/.bash_profile echo"exportORACLE_HOME=/u01/app/11.2.0/grid">>/home/grid/.bash_profile echo"exportORACLE_TERM=xterm">>/home/grid/.bash_profile echo"exportNLS_DATE_FORMAT='yyyy/mm/ddhh24:mi:ss'">>/home/grid/.bash_profile echo'exportTNS_ADMIN=$ORACLE_HOME/network/admin'>>/home/grid/.bash_profile echo'exportPATH=/usr/sbin:$PATH'>>/home/grid/.bash_profile echo'exportPATH=$ORACLE_HOME/bin:$PATH'>>/home/grid/.bash_profile echo'exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>>/home/grid/.bash_profile echo'exportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>>/home/grid/.bash_profile echo"exportEDITOR=vi">>/home/grid/.bash_profile echo"exportLANG=en_US">>/home/grid/.bash_profile echo"exportNLS_LANG=american_america.AL32UTF8">>/home/grid/.bash_profile echo"umask022">>/home/grid/.bash_profile groupadd-g1300dba groupadd-g1301oper useradd-u1101-goinstall-Gdba,oper,asmdba-d/home/oracle-s/bin/bash-c"OracleSoftwareOwner"oracle echo"oracle"|passwd--stdinoracle echo'exportPS1="`/bin/hostname-s`->"'>>/home/oracle/.bash_profile echo"exportTMP=/tmp">>/home/oracle/.bash_profile echo'exportTMPDIR=$TMP'>>/home/oracle/.bash_profile echo"exportORACLE_HOSTNAME=node1.localdomain">>/home/oracle/.bash_profile echo"exportORACLE_SID=devdb1">>/home/oracle/.bash_profile echo"exportORACLE_BASE=/u01/app/oracle">>/home/oracle/.bash_profile echo'exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1'>>/home/oracle/.bash_profile echo"exportORACLE_UNQNAME=devdb">>/home/oracle/.bash_profile echo'exportTNS_ADMIN=$ORACLE_HOME/network/admin'>>/home/oracle/.bash_profile echo"exportORACLE_TERM=xterm">>/home/oracle/.bash_profile echo'exportPATH=/usr/sbin:$PATH'>>/home/oracle/.bash_profile echo'exportPATH=$ORACLE_HOME/bin:$PATH'>>/home/oracle/.bash_profile echo'exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>>/home/oracle/.bash_profile echo'exportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>>/home/oracle/.bash_profile echo"exportEDITOR=vi">>/home/oracle/.bash_profile echo"exportLANG=en_US">>/home/oracle/.bash_profile echo"exportNLS_LANG=american_america.AL32UTF8">>/home/oracle/.bash_profile echo"exportNLS_DATE_FORMAT='yyyy/mm/ddhh24:mi:ss'">>/home/oracle/.bash_profile echo"umask022">>/home/oracle/.bash_profile echo"TheGroupsandusershasbeencreated" echo"TheEnvironmentforgrid,oraclealsohasbeensetsuccessfully"
2、predir.sh脚本
#!/bin/bash #Purpose:Createthenecessarydirectoryfororacle,gridusersandchangetheauthentiontooracle,gridusers. #Usage:logonasthesuperuser('root'),andthenexecutethecommand:#./2predir.sh #Author:AsherHuang echo"Nowcreatethenecessarydirectoryfororacle,gridusers..." mkdir-p/u01/app/grid mkdir-p/u01/app/11.2.0/grid mkdir-p/u01/app/oracle chown-Roracle:oinstall/u01 chown-Rgrid:oinstall/u01/app/grid chown-Rgrid:oinstall/u01/app/11.2.0 chmod-R775/u01 echo"Thenecessarydirectoryfororacle,gridusershasbeenfinished"
3、prelimits.sh脚本
#!/bin/bash #Purpose:Changethe/etc/security/limits.conf. #Usage:logonasthesuperuser('root'),andthenexecutethecommand:#./3prelimits.sh #Author:AsherHuang echo"Nowmodifythe/etc/security/limits.conf,butbackupitnamed/etc/security/limits.conf.bakbefore" cp/etc/security/limits.conf/etc/security/limits.conf.bak echo"oraclesoftnproc2047">>/etc/security/limits.conf echo"oraclehardnproc16384">>/etc/security/limits.conf echo"oraclesoftnofile1024">>/etc/security/limits.conf echo"oraclehardnofile65536">>/etc/security/limits.conf echo"gridsoftnproc2047">>/etc/security/limits.conf echo"gridhardnproc16384">>/etc/security/limits.conf echo"gridsoftnofile1024">>/etc/security/limits.conf echo"gridhardnofile65536">>/etc/security/limits.conf echo"Modifingthe/etc/security/limits.confhasbeensucceed."
4、prelogin.sh脚本
#!/bin/bash #Purpose:Modifythe/etc/pam.d/login. #Usage:logonasthesuperuser('root'),andthenexecutethecommand:#./4prelimits.sh #Author:AsherHuang echo"Nowmodifythe/etc/pam.d/login,butwithabackupnamed/etc/pam.d/login.bak" cp/etc/pam.d/login/etc/pam.d/login.bak echo"sessionrequired/lib/security/pam_limits.so">>/etc/pam.d/login echo"sessionrequiredpam_limits.so">>/etc/pam.d/login echo"Modifingthe/etc/pam.d/loginhasbeensucceed."
5、preprofile.sh脚本
#!/bin/bash #Purpose:Modifythe/etc/profile. #Usage:logonasthesuperuser('root'),andthenexecutethecommand:#./5preprofile.sh #Author:AsherHuang echo"Nowmodifythe/etc/profile,butwithabackupnamed/etc/profile.bak" cp/etc/profile/etc/profile.bak echo'if[$USER="oracle"]||[$USER="grid"];then'>>/etc/profile echo'if[$SHELL="/bin/ksh"];then'>>/etc/profile echo'ulimit-p16384'>>/etc/profile echo'ulimit-n65536'>>/etc/profile echo'else'>>/etc/profile echo'ulimit-u16384-n65536'>>/etc/profile echo'fi'>>/etc/profile echo'fi'>>/etc/profile echo"Modifingthe/etc/profilehasbeensucceed."
6、presysctl.sh脚本
#!/bin/bash #Purpose:Modifythe/etc/sysctl.conf. #Usage:logonasthesuperuser('root'),andthenexecutethecommand:#./6presysctl.sh #Author:AsherHuang echo"Nowmodifythe/etc/sysctl.conf,butwithabackupnamed/etc/sysctl.bak" cp/etc/sysctl.conf/etc/sysctl.conf.bak echo"fs.aio-max-nr=1048576">>/etc/sysctl.conf echo"fs.file-max=6815744">>/etc/sysctl.conf echo"kernel.shmall=2097152">>/etc/sysctl.conf echo"kernel.shmmax=1054472192">>/etc/sysctl.conf echo"kernel.shmmni=4096">>/etc/sysctl.conf echo"kernel.sem=25032000100128">>/etc/sysctl.conf echo"net.ipv4.ip_local_port_range=900065500">>/etc/sysctl.conf echo"net.core.rmem_default=262144">>/etc/sysctl.conf echo"net.core.rmem_max=4194304">>/etc/sysctl.conf echo"net.core.wmem_default=262144">>/etc/sysctl.conf echo"net.core.wmem_max=1048586">>/etc/sysctl.conf echo"net.ipv4.tcp_wmem=262144262144262144">>/etc/sysctl.conf echo"net.ipv4.tcp_rmem=419430441943044194304">>/etc/sysctl.conf echo"Modifingthe/etc/sysctl.confhasbeensucceed." echo"Nowmakethechangestakeeffect....." sysctl-p
参考博文:http://www.oracleonlinux.cn/2012/06/step-by-step-install-11gr2-rac-on-linux-8/
原文链接:https://www.f2er.com/oracle/210504.html