Linux一键部署oracle安装环境脚本(推荐)
程序员文章站
2022-07-06 10:57:56
具体代码如下所示:
#!/bin/bash
############################################
###功能:preparation...
具体代码如下所示:
#!/bin/bash ############################################ ###功能:preparation for oracle installation ###参数:sid base ###其中,sid指的是oracle_sid ###base指的是oracle_base的一级目录,如oracle_base=/u01/app/oracle,则base为/u01 ############################################ #检查参数个数是否正确 if [ $# -ne 2 ];then echo "$0 sid base" exit fi sid="$1" base="$2" #主机名绑定 ip=`ifconfig |awk -f'[: ]+' 'nr==2{print $4'}` host=`hostname` sed -i '$a'$ip' '$host'' /etc/hosts #checking the package requirements #将需要安装的表的列表贴在package_list文件中 awk -f'-[0-9]' '{print $1}' package_list |awk '{print $1}' |uniq |xargs yum install -y > output.log 2>&1 #creating required operating system groups and users groupadd -g 800 oinstall groupadd -g 801 dba groupadd -g 802 oper useradd -g oinstall -g dba,oper oracle echo oracle | passwd --stdin oracle >> output.log 2>&1 #configure kernal parameters 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 = 250 32000 100 128' /etc/sysctl.conf sed -i '$a\net.ipv4.ip_local_port_range = 9000 65500' /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.log 2>&1 #configure resource limits sed -i '$a\oracle soft nproc 2047' /etc/security/limits.conf sed -i '$a\oracle hard nproc 16384' /etc/security/limits.conf sed -i '$a\oracle soft nofile 1024' /etc/security/limits.conf sed -i '$a\oracle hard nofile 65536' /etc/security/limits.conf #add the following line to the /etc/pam.d/login file, if it does not already exist: sed -i '$a\session required pam_limits.so' /etc/pam.d/login #add the following line to the /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 -p 16384' /etc/profile sed -i '$a\ ulimit -n 65536' /etc/profile sed -i '$a\ else' /etc/profile sed -i '$a\ ulimit -u 16384 -n 65536' /etc/profile sed -i '$a\ fi' /etc/profile sed -i '$a\fi' /etc/profile source /etc/profile #configuring the oracle user's environment sed -i '$a\export oracle_sid='$sid'' /home/oracle/.bash_profile sed -i '$a\export oracle_base='$base'/app/oracle' /home/oracle/.bash_profile sed -i '$a\export oracle_home=$oracle_base/product/11.2.0/db_1' /home/oracle/.bash_profile sed -i '$a\export path=$oracle_home/bin:$path' /home/oracle/.bash_profile source /home/oracle/.bash_profile #creating required directories mkdir -p $oracle_home chown -r oracle.oinstall $base/app chmod -r 775 $base/app echo "preparation for oracle installation is over!"
总结
以上所述是小编给大家介绍的linux一键部署oracle安装环境脚本,希望对大家有所帮助
上一篇: WebForm增删(批删)改查(多条件)
下一篇: Android 请求网络接口实现方法