Linux一键部署oracle安装环境脚本(推荐)
具体代码如下所示:
#!/bin/bash ############################################ ###功能:PreparationforOracleInstallation ###参数:SIDBASE ###其中,sid指的是ORACLE_SID ###BASE指的是ORACLE_BASE的一级目录,如ORACLE_BASE=/u01/app/oracle,则BASE为/u01 ############################################ #检查参数个数是否正确 if[$#-ne2];then echo"$0SIDBASE" exit fi SID="$1" BASE="$2" #主机名绑定 IP=`ifconfig|awk-F'[:]+''NR==2{print$4'}` HOST=`hostname` sed-i'$a'$IP''$HOST''/etc/hosts #CheckingthePackageRequirements #将需要安装的表的列表贴在Package_list文件中 awk-F'-[0-9]''{print$1}'Package_list|awk'{print$1}'|uniq|xargsyuminstall-y>output.log2>&1 #CreatingRequiredOperatingSystemGroupsandUsers groupadd-g800oinstall groupadd-g801dba groupadd-g802oper useradd-goinstall-Gdba,operoracle echooracle|passwd--stdinoracle>>output.log2>&1 #ConfigureKernalParameters sed-i'$a\fs.aio-max-nr=1048576'/etc/sysctl.conf sed-i'$a\fs.file-max=6815744'/etc/sysctl.conf sed-i'$a\kernel.shmall=2097152'/etc/sysctl.conf sed-i'$a\kernel.shmmax=536870912'/etc/sysctl.conf sed-i'$a\kernel.shmmni=4096'/etc/sysctl.conf sed-i'$a\kernel.sem=25032000100128'/etc/sysctl.conf sed-i'$a\net.ipv4.ip_local_port_range=900065500'/etc/sysctl.conf sed-i'$a\net.core.rmem_default=262144'/etc/sysctl.conf sed-i'$a\net.core.rmem_max=4194304'/etc/sysctl.conf sed-i'$a\net.core.wmem_default=262144'/etc/sysctl.conf sed-i'$a\net.core.wmem_max=1048586'/etc/sysctl.conf sysctl-p>>output.log2>&1 #ConfigureResourceLimits sed-i'$a\oraclesoftnproc2047'/etc/security/limits.conf sed-i'$a\oraclehardnproc16384'/etc/security/limits.conf sed-i'$a\oraclesoftnofile1024'/etc/security/limits.conf sed-i'$a\oraclehardnofile65536'/etc/security/limits.conf #Addthefollowinglinetothe/etc/pam.d/loginfile,ifitdoesnotalreadyexist: sed-i'$a\sessionrequiredpam_limits.so'/etc/pam.d/login #Addthefollowinglinetothe/etc/profile sed-i'$a\if[[$USER="oracle"]];then'/etc/profile sed-i'$a\if[[$SHELL="/bin/ksh"]];then'/etc/profile sed-i'$a\ulimit-p16384'/etc/profile sed-i'$a\ulimit-n65536'/etc/profile sed-i'$a\else'/etc/profile sed-i'$a\ulimit-u16384-n65536'/etc/profile sed-i'$a\fi'/etc/profile sed-i'$a\fi'/etc/profile source/etc/profile #ConfiguringtheoracleUser'sEnvironment sed-i'$a\exportORACLE_SID='$SID''/home/oracle/.bash_profile sed-i'$a\exportORACLE_BASE='$BASE'/app/oracle'/home/oracle/.bash_profile sed-i'$a\exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1'/home/oracle/.bash_profile sed-i'$a\exportPATH=$ORACLE_HOME/bin:$PATH'/home/oracle/.bash_profile source/home/oracle/.bash_profile #CreatingRequiredDirectories mkdir-p$ORACLE_HOME chown-Roracle.oinstall$BASE/app chmod-R775$BASE/app echo"PreparationForOracleInstallationIsOver!"
总结
以上所述是小编给大家介绍的Linux一键部署oracle安装环境脚本,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。