Data Guard Physical Standby Setup Using the Data Guard Broker in Oracle 12.2 之01准备(DB安装)

1. 分配给临时文件系统的磁盘空间	
    临时目录中至少有1 GB的空间。Oracle建议2 GB或更多

2. 交换相对于RAM的空间分配	
   4 GB到16 GB之间:等于RAM的大小
   超过16 GB:16 GB 

3. 验证共享内存(/dev/shm)是否已正确安装且大小足够
     > SGA+PGA 或 =物理内存*50%

1.所需软件介绍

序号 类型 内容
1 数据库 linuxx64_12201_database.zip
2 操作系统 OracleLinux-R7-U6-Server-x86_64-dvd.iso
3 虚拟机软件 VMware? Workstation 12 Pro 12.5.9 build-7535481
4 工具 Xmanager Enterprise 5
5 工具 rlwrap-0.42 (用于记录sqlplus、rman等命令的历史记录)

2.IP地址规划

主机名 IP接口名稱 地址类型 IP 地址 注册位置
xag138 xag138 DB 192.168.40.138 /etc/hosts

3.操作系统本地磁盘分区规划

序号 分区名称 大小 用途说明
1 /boot 200MB 引导分区
2 /tmp 4G 临时空间
3 /home 4G 所有用户的home目录
4 swap 8G 交换分区(物理內存小於8G則 *2 反之 同物理內存
5 / 38G 根分区 oracle和grid的安装目录

4.網卡配置

[root@xag138 ~]# cd /etc/sysconfig/network-scripts/

[root@xag138 network-scripts]# cat ifcfg-ens33 
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="ens33"
UUID="0224e944-0b68-47d5-b327-71d0e5560845"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="192.168.40.138"
GATEWAY="192.168.40.2"
NETMASK="255.255.255.0"
DNS1="8.8.8.8"

#重啟網卡
[root@xag138 network-scripts]# service network restart

5.禁用防火墙

#关闭firewall:停止firewall
systemctl stop firewalld.service

#禁止firewall开机启动
systemctl disable firewalld.service

6.安裝基本工具

[root@XAG138 ~]# yum -y install nano vim wget curl net-tools lsof  zip unzip

#安裝rlwrap
[root@XAG138 ~]# cd /usr/local/src

[root@XAG138 src]# pwd
/usr/local/src
[root@XAG138 src]# yum -y install perl autoconf

[root@XAG138 src]# wget http://www.rpmfind.net/linux/epel/6/x86_64/Packages/r/rlwrap-0.42-1.el6.x86_64.rpm

[root@XAG138 src]# rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm

7.配置主机名

[root@xag138 ~]# cat /etc/hostname
xag138

[root@xag138 java]# cat /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=xag138

vim /etc/hosts
#增加如下
192.168.40.138  xag138

8.Automatic Setup(自动配置)

[root@xag138 ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).

[root@xag138 ~]# yum install oracle-database-server-12cR2-preinstall -y 

[root@xag138 ~]# yum install elfutils-libelf-devel  -y

[root@xag138 src]# pwd
/usr/local/src

#CentOS 7上如下配置(本次为Oracle Linux 无需)
[root@xag138 /]# cat /etc/security/limits.conf
oracle   soft   nofile    16384
oracle   hard   nofile    65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
oracle   hard   memlock    134217728
oracle   soft   memlock    134217728


#### 修改
将  
oracle   soft   nofile    1024  
改成
oracle   soft   nofile    16384

#Oracle Linux 需要如下配置
[root@xag138 limits.d]# cat /etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf
# oracle-database-server-12cR2-preinstall setting for nofile soft limit is 1024
oracle   soft   nofile    16384
# oracle-database-server-12cR2-preinstall setting for nofile hard limit is 65536
oracle   hard   nofile    65536
# oracle-database-server-12cR2-preinstall setting for nproc soft limit is 16384
# refer orabug15971421 for more info.
oracle   soft   nproc    16384
# oracle-database-server-12cR2-preinstall setting for nproc hard limit is 16384
oracle   hard   nproc    16384
# oracle-database-server-12cR2-preinstall setting for stack soft limit is 10240KB
oracle   soft   stack    10240
# oracle-database-server-12cR2-preinstall setting for stack hard limit is 32768KB
oracle   hard   stack    32768
# oracle-database-server-12cR2-preinstall setting for memlock hard limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90 % of RAM
oracle   hard   memlock    134217728
# oracle-database-server-12cR2-preinstall setting for memlock soft limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90% of RAM
oracle   soft   memlock    134217728


[root@xag138 /]# cat /etc/sysctl.conf
# oracle-database-server-12cR2-preinstall setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-database-server-12cR2-preinstall setting for kernel.sem is ‘250 32000 100 128‘
kernel.sem = 250 32000 100 128
# oracle-database-server-12cR2-preinstall setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-database-server-12cR2-preinstall setting for kernel.shmall is 1073741824 on x86_64
kernel.shmall = 1073741824
# oracle-database-server-12cR2-preinstall setting for kernel.shmmax is 4398046511104 on x86_64
kernel.shmmax = 4398046511104
# oracle-database-server-12cR2-preinstall setting for kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1
# oracle-database-server-12cR2-preinstall setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-database-server-12cR2-preinstall setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-database-server-12cR2-preinstall setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-database-server-12cR2-preinstall setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-database-server-12cR2-preinstall setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
# oracle-database-server-12cR2-preinstall setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
# oracle-database-server-12cR2-preinstall setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-database-server-12cR2-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500

[root@xag138 src]# /sbin/sysctl -p

#可选项
[root@xag138 ~]# yum update

9.Additional Setup

#编辑 /etc/selinux/config

[root@xag138 /]# cat /etc/selinux/config

#SELINUX=enforcing
#SELINUXTYPE=targeted
SELINUX=permissive 

#生效 
[root@xag138 /]# setenforce Permissive

groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
#groupadd -g 54324 backupdba
#groupadd -g 54325 dgdba
#groupadd -g 54326 kmdba
#groupadd -g 54327 asmdba
#groupadd -g 54328 asmoper
#groupadd -g 54329 asmadmin
#groupadd -g 54330 racdba

useradd -u 54321 -g oinstall -G dba,oper oracle

#oracle用户的登录密码,后续登录要用,记着。
echo "123456" | passwd --stdin oracle

#设置密码永不过期
chage -M -1 oracle
chage -l oracle

[root@xag138 /]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)

10.安装依赖包

# OL6 and OL7 (RHEL6 and RHEL7)
yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install make -y
yum install nfs-utils -y
yum install net-tools -y
yum install smartmontools -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

11.创建目录

mkdir -p /u01/app/oracle/product/12.2.0.1/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01

mkdir -p /u02/oradata/
chown -R oracle:oinstall /u02
chmod -R 775 /u02

11.配置/dev/shm大小

#验证共享内存是否已正确安装且大小足够 
# > SGA+PGA 或 =物理内存*50%

vim /etc/fstab

#修改/dev/shm的大小  
修改/etc/fstab的这行: 默认的:
tmpfs /dev/shm tmpfs defaults 0 0
改成:
tmpfs /dev/shm tmpfs defaults,size=4G 0 0

#重新mount /dev/shm使之生效:
mount -o remount /dev/shm

df -h
...
tmpfs                        4.0G     0  4.0G   0% /dev/shm
...

12.创建scripts 目录及setEnv.sh文件(从此处开始无特别说明都是在oracle用户下操作)

[oracle@xag138 ~]$ mkdir /home/oracle/scripts

#创建 setEnv.sh 文件 [不同机器上 ORACLE_ 的 HOSTNAME、UNQNAME、SID 不同]
----------------------------------------------------------------------
cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP

export ORACLE_HOSTNAME=xag138
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=cdb1

export PATH=/usr/sbin:/usr/local/bin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH

export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
alias sqlplus=‘rlwrap sqlplus‘
alias rman=‘rlwrap rman‘
EOF
=================================================================

[oracle@xag138 setup]$ cat /home/oracle/scripts/setEnv.sh
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=xag138
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=cdb1

export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias sqlplus=‘rlwrap sqlplus‘
alias rman=‘rlwrap rman‘



#Add a reference to the "setEnv.sh" file at "/home/oracle/.bash_profile" file
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

#生效
source /home/oracle/.bash_profile

#Create a "start_all.sh" and "stop_all.sh" script 
---------------------------------------------------------------
cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

dbstart \$ORACLE_HOME
EOF
---------------------------------------------------------------
cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

dbshut \$ORACLE_HOME
EOF
=====================================================
chown -R oracle.oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh

13.解压

[oracle@xag138 setup]$ pwd
/u01/setup
[oracle@xag138 setup]$ ls
linuxx64_12201_database.zip

[oracle@xag138 setup]$ unzip linuxx64_12201_database.zip

[oracle@xag138 setup]$ rm linuxx64_12201_database.zip 

14.安装

[oracle@xag138 database]$ pwd
/u01/setup/database

[oracle@xag138 database]$ export DISPLAY=192.168.0.7:0.0
[oracle@xag138 database]$ ./runInstaller

Data Guard Physical Standby Setup Using the Data Guard Broker in Oracle 12.2 之01准备(DB安装)

上一篇:jQuery 项目常用函数


下一篇:Vue.js学习(五)—— vue-cli初始化项目的坑终极解决办法和总结(离线安装webpack下载模板)