脚本主要用于redhat平台安装11g和12c软件
依赖包检查与安装
用户、组检查与安装
系统内核、用户限制
防火墙、selinux关闭
注意,linux组脚本中只创建了dba,通常会创建oinstall和dba
#################
#
#
#create : 2018/01/22
#version : v0.0
#describe : Oracle 11g/12c setup single instance install environment
#################
DATE=`date +%Y%m%d%H%M%S`
SYSCTLCONF="/etc/sysctl.conf"
LIMITSCONF="/etc/security/limits.conf"
LOGINFILE="/etc/pam.d/login"
PROFILE="/etc/profile"
YUMFILE="/etc/yum.repos.d/rhel-source.repo"
echo -e "\nTo determine the distribution and version of Linux installed.\n"
echo "`cat /proc/version`"
echo -e "\nTo determine whether the required kernel is installed.\n"
echo "`uname -a`"
echo -e "\nLeast 4GB of RAM.\n"
echo "`grep MemTotal /proc/meminfo`"
echo -e "\nTo determine the size of the configured swap space,enter the following command.\n"
echo "`grep SwapTotal /proc/meminfo`"
echo -e "\nChecking the Software Requirements.\n"
yes|cp -p ${YUMFILE} ${YUMFILE}.bak.${DATE}
read -p "Enter installl oracle version:[12c]" ORA_VERSION
#echo "You have entered ${ORA_VERSION}"
if [ -z "${ORA_VERSION}" ];then
ORA_VERSION="12c"
fi
echo "You have entered ${ORA_VERSION}"
if [ ${ORA_VERSION} == "12c" ];then
rpmpack="
binutils
compat-libstdc++*
elfutils-libelf
elfutils-libelf-devel
gcc
gcc-c++
glibc
glibc-common
glibc-devel
glibc-headers
kernel-headers
ksh
libaio
libaio-devel
libgcc
libgomp
libstdc++
libstdc++-devel
make
sysstat
unixODBC
unixODBC-devel"
else
rpmpack="
binutils
compat-libstdc++*
elfutils-libelf
elfutils-libelf-devel
elfutils-libelf-devel-static
gcc
gcc-c++
glibc
glibc-common
glibc-devel
glibc-headers
kernel-headers
pdksh
libaio
libaio-devel
libgcc
libgomp
libstdc++
libstdc++-devel
make
sysstat
unixODBC
unixODBC-devel"
fi
read -p "Enter yum source address:" URL_PTAH
#echo "You have entered ${URL_PTAH}"
echo ${#URL_PTAH}
if [ ${#URL_PTAH} -gt 0 ];then
echo "You have entered ${URL_PTAH}"
`grep ${URL_PTAH} ${YUMFILE} > /dev/null`
if [ $? -ne 0 ];then
echo "#add yum resouce ${DATE}" >${YUMFILE}
echo "[rhel-source]" >>${YUMFILE}
echo "name=Red Hat Enterprise Linux \$releasever - \$basearch - Source" >>${YUMFILE}
echo "baseurl=${URL_PTAH}" >>${YUMFILE}
echo "enabled=1" >>${YUMFILE}
echo "gpgcheck=0" >>${YUMFILE}
echo "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release" >>${YUMFILE}
fi
yum grouplist
fi
for pack in $rpmpack; do
rpm -qa | grep $pack > /dev/null
if [ $? -eq 1 ];then
echo "$pack not install"
yum -y install $pack
fi
echo "rpm -qa | grep $pack is already install."
#read -p "Enter yum source address:" URL_PTAH
#echo "You have entered ${URL_PTAH}"
done
echo -e "\nTo determine if the Oracle Inventory group exit.\n"
echo " `grep oinstall /etc/group`"
echo " `grep dba /etc/group`"
echo -e "\nTo determine whether the oraInstall.loc file exists.\n"
echo "`cat /etc/oraInst.loc`"
#################################
#################################
echo -e "\nCreating Required Operating System Groups and Users.\n"
`grep dba /etc/group > /dev/null`
if [ $? -ne 0 ];then
echo "groupadd dba"
`groupadd dba`
fi
`grep oracle /etc/passwd > /dev/null`
if [ $? -ne 0 ]; then
echo "useradd -g dba oracle"
`useradd -g dba oracle`
echo "oracle#1234" | `passwd --stdin oracle`
fi
echo "`id oracle`"
if [ ! -d "/u01/app/oracle" ];then
echo -e "\nmkdir -p /u01/app/oracle\nmkdir -p /u01/app/oraInventory\nmkdir -p /u01/app/oracle/product/11.2.0/dbhome_1\nchown -R oracle.dba /u01\nchmod -R 775 /u01\n"
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
if [ ${ORA_VERSION} == "12c" ];then
mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1
else
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
fi
chown -R oracle.dba /u01
chmod -R 775 /u01
fi
ls -al /u01
#############################
#SYSCTLCONF="/etc/sysctl.conf"
#LIMITSCONF="/etc/security/limits.conf"
#LOGINFILE="/etc/pam.d/login"
#PROFILE="/etc/profile"
#############################
echo -e "\nCheckResource Limits for the Oracle Software Installation Users.\n"
yes|cp -p ${LIMITSCONF} ${LIMITSCONF}.bak.${DATE}
echo -e "\nInstallation Owner Resource Limit Recommended Ranges.\n"
`grep "#add limit" ${LIMITSCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "#add limit ${DATE}" >>${LIMITSCONF}
fi
`grep "oracle soft nproc 2047" ${LIMITSCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "oracle soft nproc 2047" >> ${LIMITSCONF}
fi
`grep "oracle hard nproc 16384" ${LIMITSCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "oracle hard nproc 16384" >> ${LIMITSCONF}
fi
`grep "oracle soft nofile 1024" ${LIMITSCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "oracle soft nofile 1024" >> ${LIMITSCONF}
fi
`grep "oracle hard nofile 65536" ${LIMITSCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "oracle hard nofile 65536" >> ${LIMITSCONF}
fi
echo "`tail -n 5 /etc/security/limits.conf`"
########################
########################
echo -e "\nConfiguring Kernel Parameters for Linux.\n"
yes|cp -p ${SYSCTLCONF} ${SYSCTLCONF}.bak.${DATE}
`grep "#add sysctl" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "#add sysctl ${DATE}" >> ${SYSCTLCONF}
fi
`grep "kernel.shmmni = 4096" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "kernel.shmmni = 4096" >> ${SYSCTLCONF}
fi
`grep "kernel.sem = 250 32000 100 142" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "kernel.sem = 250 32000 100 142" >> ${SYSCTLCONF}
fi
`grep "fs.aio-max-nr = 1048576" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "fs.aio-max-nr = 1048576" >> ${SYSCTLCONF}
fi
`grep "fs.file-max = 6815744" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "fs.file-max = 6815744" >> ${SYSCTLCONF}
fi
`grep "net.ipv4.ip_local_port_range = 9000 65000" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "net.ipv4.ip_local_port_range = 9000 65000" >> ${SYSCTLCONF}
fi
`grep "net.core.rmem_default = 262144" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "net.core.rmem_default = 262144" >> ${SYSCTLCONF}
fi
`grep "net.core.rmem_max = 4194304" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "net.core.rmem_max = 4194304" >> ${SYSCTLCONF}
fi
`grep "net.core.wmem_default =262144" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "net.core.wmem_default =262144" >> ${SYSCTLCONF}
fi
`grep "net.core.wmem_max = 1048576" ${SYSCTLCONF} > /dev/null`
if [ $? -ne 0 ];then
echo "net.core.wmem_max = 1048576" >> ${SYSCTLCONF}
fi
/sbin/sysctl -p
########################
#######################
echo -e "\nedit /etc/pam.d/login file:\n"
yes|cp -p ${LOGINFILE} ${LOGINFILE}.bak.${DATE}
`grep "session required pam_limits.so" ${LOGINFILE} >/dev/nulll`
if [ $? -ne 0 ];then
echo "#add login ${DATE}" >>${LOGINFILE}
echo "session required pam_limits.so" >> ${LOGINFILE}
fi
echo "`tail -n 2 ${LOGINFILE}`"
#######################
######################
echo -e "\nedit /etc/pfole file:\n"
yes|cp -p ${PROFILE} ${PROFILE}.bak.${DATE}
`grep "#add ulimit profile" ${PROFILE} >/dev/null`
if [ $? -ne 0 ];then
echo "#add ulimit profile ${DATE}" >>${PROFILE}
echo "if [ \$USER = \"oracle\" ]; then" >>${PROFILE}
echo " if [ \$SHELL = \"/bin/ksh\" ]; then" >>${PROFILE}
echo " ulimit -p 16384" >>${PROFILE}
echo " ulimit -n 65536" >>${PROFILE}
echo " else" >>${PROFILE}
echo " ulimit -u 16384 -n 65536" >>${PROFILE}
echo " fi" >> ${PROFILE}
echo "fi" >>${PROFILE}
fi
echo "`tail -n 9 ${PROFILE}`"
######################
#####################
echo -e "\nDisabled system firewall.\n"
`chkconfig iptables off&&chkconfig ip6tables off&&service iptables stop&&service ip6tables stop`
echo `chkconfig --list|grep iptables`
echo `chkconfig --list|grep ip6tables`
#####################
#####################
echo -e "\nDisabled system selinux.\n"
`sed -i 's/^SELINUX=enforcing/#SELINUX=enforcing/g' /etc/selinux/config`
`grep "^SELINUX=disabled" /etc/selinux/config >/dev/null`
if [ $? -ne 0 ];then
echo "SELINUX=disabled" >> /etc/selinux/config
fi
echo "`cat -n /etc/selinux/config|grep SELINUX`"
#####################
- Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考
操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...
- Oracle 11g 单实例到单实例OGG同步实施文档-OGG initial load
Oracle 11g 单实例到单实例OGG同步实施文档-OGG initial load 2018-06-07 00:514730原创GoldenGate 作者: leo 本文链接:https://w ...
- Oracle 11g 单实例到单实例OGG同步实施文档-RMAN 初始化
Oracle 11g 单实例到单实例OGG同步实施文档-RMAN 初始化 2018-06-07 13:455170原创GoldenGate 作者: leo 本文链接:https://www.cndba ...
- Oracle 11g 单实例到单实例OGG同步实施文档-EXPDP初始化
Oracle 11g 单实例到单实例OGG同步实施文档-EXPDP初始化 2018-06-07 00:446470原创GoldenGate 作者: leo 本文链接:https://www.cndba ...
- centos部署oracle rac单实例11.2.0.3数据库(使用asm磁盘)
部署oracle rac单实例数据库,需要安装grid和datavase两部分,所以首先创建两个用户oracle和grid,因为不能使用root用户进行安装,在安装之前首先需要修改一些系统参数和安装一 ...
- oracle ogg 单实例双向复制搭建(oracle-oracle)--Oracle GoldenGate
oracle ogg 单实例双向复制搭建(oracle-oracle)--Oracle GoldenGate --继昨天的测试,这一篇实施单实例双向复制(完全重新搭建) --环境不变 db1,db2( ...
- Oracle 11g 单实例静默安装实战记录(linux)
oracle 11g 单实例静默安装 AUTHOR:Oracle_Ran 环境规划: OS Version : Red Hat Enterprise Linux Server release 6.7 ...
- Oracle 19c单实例部署
目录 Oracle 19c单实例部署: 1.配置yum: 2.安装rpm包: 3.设置hostname: 4.配置hostname解析: 5.配置时钟同步服务(ntp): 6.检查及配置内核参数: 7 ...
- Oracle DataBase单实例使用ASM案例(1)--ASM基本概念
版权声明:本文为博主原创文章,未经博主允许不得转载. Oracle DataBase单实例使用ASM案例(1)--ASM基本概念 系统环境: 操作系统:RH EL5-64 Oracle 软件: Ora ...
随机推荐
- WebClient用法小结(转载)
如果只想从特定的URI请求文件,则使用WebClient,它是最简单的.NET类,它只用一两条命令执行基本操作,.NET FRAMEWORK目前支持以http:.https:.ftp:.和 file: ...
- 139.00.009提高Github Clone速度
@(139 - Environment Settings | 环境配置) Method 1 :SS+系统内置代理 用 git 内置代理,直接走系统中运行的代理工具中转,比如,你的 SS 本地端口是 1 ...
- 139.00.006 Git学习-标签管理Tag
@(139 - Environment Settings | 环境配置) 一.Why 发布一个版本时,我们通常先在版本库中打一个标签(tag),这样,就唯一确定了打标签时刻的版本.将来无论什么时候,取 ...
- Android 6.0+ 运行时权限
1.权限被分为了普通和危险两种 2.打电话的Demo import android.Manifest; import android.app.Activity; import android.cont ...
- Retrofit 抽象工厂模式
https://blog.csdn.net/h176nhx7/article/details/78139371
- jar 解压war包到指定目录
用 jar -xvf .jar 命令默认解压到当前目录,想要解压到指定目录 需要使用unzip .jar -d 目录 如: unzip pay.war -d /home/zookeeper1/tes ...
- idea导入项目报错:文档中根元素前面的标记必须格式正确
今天从git上面导入项目之后,由于是上周刚刚提交过的,本地也没有什么修改,于是就从gitlab上面直接下载下来了.可是项目启动时候,报错了... 文档中根元素前面的标记必须格式正确 想想 原来是上次提 ...
- png的故事:隔行扫描算法
转载自AlloyTeam:http://www.alloyteam.com/2017/06/the-story-of-png-deinterlacing-algorithm/ 前言 前文已经讲解过如何 ...
- Mysql 性能调优参数
1.DEFAULT_STORAGE_ENGINE <br\>如果你已经在用MySQL 5.6或者5.7,并且你的数据表都是InnoDB,那么表示你已经设置好了.如果没有,确保把你的表转换为 ...
- Python学习---重点模块之shelve
简单示例 import shelve f = shelve.open(r'shelve.txt') f['info'] = {'name':'ftl', 'age':23, 'sex': 'male' ...