当前位置: 首页 > 编程笔记 >

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

权烨磊
2023-03-14
本文向大家介绍Linux一键部署oracle安装环境脚本(推荐),包括了Linux一键部署oracle安装环境脚本(推荐)的使用技巧和注意事项,需要的朋友参考一下

具体代码如下所示:

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

 类似资料:
  • 本文向大家介绍script_tool_for_linux.bash: Linux 环境下的 hosts 一键部署脚本,包括了script_tool_for_linux.bash: Linux 环境下的 hosts 一键部署脚本的使用技巧和注意事项,需要的朋友参考一下 Linux 环境下的 hosts 一键部署脚本,由 @lstoars 贡献; @fluviusmagnus 提供增强版本。 官方网站

  • 一、前置条件 Flume 需要依赖 JDK 1.8+,JDK 安装方式见本仓库: Linux 环境下 JDK 安装 二 、安装步骤 2.1 下载并解压 下载所需版本的 Flume,这里我下载的是 CDH 版本的 Flume。下载地址为:http://archive.cloudera.com/cdh5/cdh/5/ # 下载后进行解压 tar -zxvf flume-ng-1.6.0-cdh5.1

  • 一、安装Hive 1.1 下载并解压 下载所需版本的 Hive,这里我下载版本为 cdh5.15.2。下载地址:http://archive.cloudera.com/cdh5/cdh/5/ # 下载后进行解压 tar -zxvf hive-1.1.0-cdh5.15.2.tar.gz 1.2 配置环境变量 # vim /etc/profile 添加环境变量: export HIVE_HOM

  • 本文向大家介绍linux环境部署及docker安装redis的方法,包括了linux环境部署及docker安装redis的方法的使用技巧和注意事项,需要的朋友参考一下 安装步骤 1. 安装Redis 通过docker search redis和docker pull redis下载redis镜像 2. 新建挂载配置文件夹 新建data和conf两个文件夹,位置随意。 注:因为 redis 默认配置

  • 本文向大家介绍shell脚本一键安装php7的实例(推荐),包括了shell脚本一键安装php7的实例(推荐)的使用技巧和注意事项,需要的朋友参考一下 如下所示: 以上这篇shell脚本一键安装php7的实例(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持呐喊教程。

  • 本文向大家介绍VMware中linux环境下oracle安装图文教程(一),包括了VMware中linux环境下oracle安装图文教程(一)的使用技巧和注意事项,需要的朋友参考一下 安装流程:前期准备工作--->安装ORACLE软件--->安装升级补丁--->安装odbc创建数据库--->安装监听器--->安装EM 《前期准备工作》 安装配置系统环境 安装linux , 所有服务都不选择,只是选

  • 本文向大家介绍Linux下安装tomcat并部署网站(推荐),包括了Linux下安装tomcat并部署网站(推荐)的使用技巧和注意事项,需要的朋友参考一下 安装jdk: Oracle官方下载 https://www.oracle.com/technetwork/java/javase/downloads/index.html yum安装openjdk: 1.查找可使用的jdk包: [root@li

  • 本文向大家介绍阿里云ECS(linux)一键安装web环境sh安装步骤,包括了阿里云ECS(linux)一键安装web环境sh安装步骤的使用技巧和注意事项,需要的朋友参考一下 准备好连接linux服务器的工具,推荐用xshell和xftp。 一键安装包下载: 点此下载 首先登录云服务器教程《使用Xshell连接阿里云服务器》打命令去主目录(/home)看下如下: 命令一: cd /home 命令二