Linux一键部署oracle安装环境脚本(推荐)

所属分类: 数据库 / oracle 阅读数: 1811
收藏 0 赞 0 分享

具体代码如下所示:

#!/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安装环境脚本,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

更多精彩内容其他人还在看

Oracle下的Java分页功能_动力节点Java学院整理

分页的时候返回的不仅包括查询的结果集(List),而且还包括总的页数(pageNum)、当前第几页(pageNo)等等信息,所以我们封装一个查询结果PageModel类,具体实现代码,大家参考下本文
收藏 0 赞 0 分享

Win7 64位下PowerDesigner连接64位Oracle11g数据库

这篇文章主要为大家详细介绍了Win7 64位下PowerDesigner连接64位Oracle11g数据库,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

PowerDesigner15.1连接oracle11g逆向生成ER图

这篇文章主要为大家详细介绍了PowerDesigner15.1连接oracle11g逆向生成ER图的相关方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

解决Oracle批量修改问题

这篇文章主要介绍了解决Oracle批量修改问题,需要的朋友可以参考下
收藏 0 赞 0 分享

Oracle的out参数实例详解

这篇文章主要介绍了Oracle的out参数实例详解的相关资料,这里提供实例帮助大家理解这部分内容,需要的朋友可以参考下
收藏 0 赞 0 分享

详解Oracle在out参数中访问光标

这篇文章主要介绍了详解Oracle在out参数中访问光标的相关资料,这里提供实例代码帮助大家学习理解这部分内容,希望能帮助到大家,需要的朋友可以参考下
收藏 0 赞 0 分享

详解Oracle调试存储过程

这篇文章主要介绍了详解Oracle调试存储过程的相关资料,这里提供实例帮助大家学习理解这部分内容,需要的朋友可以参考下
收藏 0 赞 0 分享

Oracle的CLOB大数据字段类型操作方法

VARCHAR2既分PL/SQL Data Types中的变量类型,也分Oracle Database中的字段类型,不同场景的最大长度不同。接下来通过本文给大家分享Oracle的CLOB大数据字段类型操作方法,感兴趣的朋友一起看看吧
收藏 0 赞 0 分享

oracle中左填充(lpad)和右填充(rpad)的介绍与用法

这篇文章主要跟大家介绍了关于oracle中左填充(lpad)和右填充(rpad)的相关资料,通过填充我们可以固定字段的长度,文中通过示例代码介绍的非常详细,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。
收藏 0 赞 0 分享

Oracle回滚段使用查询代码详解

这篇文章主要介绍了Oracle回滚段使用查询代码详解的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多