centos7部署oracle 11g rac安装部署(一)
一、安装前准备
1.Oracle RAC 节点内存规划
建议SGA+PGA占整个节点物理内存的65%,其中,SGA大小容量为PGA的3倍。
1.1实际配置内存容量大小为32*16 GB=512 GB,则建议规划的
SGA和PGA分别如下:
SGA大小:512 GB * 65% * 75% = 249.6 GB(向下十位取整为240GB);
PGA大小:512 GB * 65% * 25% = 83.2 GB(向下十位取整为80GB);
1.2实际配置内存容量大小为16*16 GB=256 GB,则建议规划的
SGA和PGA分别如下:
SGA大小:256 GB * 65% * 75% = 124.8 GB(向下十位取整为120GB);
PGA大小:256 GB * 65% * 25% = 41.6 GB(向下十位取整为40GB);
2.网络规划
Hostname | short Hostname | Type | IP Address | Interface |
---|---|---|---|---|
rac1 | node1 | Public IP | 192.168.0.190 | eth0 |
node1-vip | node1-vip | Virtual IP | 192.168.0.191 | eth0:1 |
node1-priv | node1-priv | Private IP | 172.168.0.190 | eth1 |
rac2 | node2 | Public IP | 192.168.0.192 | eth0 |
node2-vip | node2-vip | Virtual IP | 192.168.0.193 | eth0:1 |
node2-priv | node2-priv | Private IP | 172.168.0.192 | eth1 |
rac3 | node3 | Public IP | 192.168.0.194 | eth0 |
node3-vip | node3-vip | Virtual IP | 192.168.0.195 | eth0:1 |
node3-priv | node3-priv | Private IP | 172.168.0.194 | eth1 |
scan-cluster | scan-cluster | Scan IP | 192.168.0.196 | eth0 |
3.配置/etc/hosts
#node1
192.168.0.190 node1
192.168.0.191 node1-vip
172.168.0.190 node1-priv
#node2
192.168.0.192 node2
192.168.0.193 node2-vip
172.168.0.192 node2-priv
#node3
192.168.0.194 node3
192.168.0.195 node3-vip
172.168.0.194 node3-priv
#scan-ip
192.168.0.196 scan-cluster
4.关闭透明大页
以防止THP带来的性能问题,最终导致节点和实例意外被移出集群。
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
if test -f /sys/kernel/mm/transparent_hugepage/enabled;then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
注意一定要执行chmod +x /etc/rc.d/rc.local
5.关闭 iptables
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl list-unit-files firewalld.service
sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
6.配置ASM磁盘
Oracle Linux 5.
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
Or this in Oracle Linux 6.
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
Or this in Oracle Linux 7 and 8.
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", SYMLINK+="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
6和7有些区别,不然会报错
SYMLINK+=\"asm-disk$i\"
centos7
NAME=\"asm-disk$i\"
centos6
for i in b c d e f g;
do
echo "KERNEL==\"sd*\", SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT==\"`/usr/lib/udev/scsi_id -g -u -d /dev/sd$i`\", SYMLINK+=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
配置文件生效
udevadm control --reload-rules
udevadm trigger --type=devices --action=change
7.配置ssh
su - oracle
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh node2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh node2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys node2:~/.ssh/authorized_keys
二、软件安装
所需软件如下,其中p18370031_112040_Linux-x86-64.zip
和p19404309_112040_Linux-x86-64.zip
是Centos7安装必须要的,否则在执行root.sh脚本的时候会报错。
![](https://img.haomeiwen.com/i7917568/143caabd0eb3d790.png)
8. grid软件安装前预检查
su - grid
unzip p13390677_112040_Linux-x86-64_3of7.zip
./runcluvfy.sh stage -pre crsinst -n node1,node2,node3 -fixup -verbose >result.txt
cat result.txt |grep failed
8.1 软件安装之前,安装 p19404309_112040_Linux-x86-64.zip :
su - grid
unzip p19404309_112040_Linux-x86-64.zip
cp b19404309/grid/cvu_prereq.xml /soft/grid/stage/cvu/(安装软件包位置)
8.2 安装grid软件
su - grid
sh runInstaller
![](https://img.haomeiwen.com/i7917568/9acfa19b649477b2.png)
![](https://img.haomeiwen.com/i7917568/f25672476bd758cb.png)
![](https://img.haomeiwen.com/i7917568/02e96a8cd315db3d.png)
![](https://img.haomeiwen.com/i7917568/e851f48e6c3e8cf1.png)
![](https://img.haomeiwen.com/i7917568/714f91883e689cb7.png)
![](https://img.haomeiwen.com/i7917568/a7bbc67395bfc07b.png)
![](https://img.haomeiwen.com/i7917568/d539c79361898324.png)
![](https://img.haomeiwen.com/i7917568/c8b61522f1ba731c.png)
![](https://img.haomeiwen.com/i7917568/0e8a1668a571273a.png)
![](https://img.haomeiwen.com/i7917568/6d10b246fa14f071.png)
![](https://img.haomeiwen.com/i7917568/503a79693f3c2b65.png)
![](https://img.haomeiwen.com/i7917568/a6a4fea27efd08ca.png)
![](https://img.haomeiwen.com/i7917568/e2a6cee5c93d3de7.png)
![](https://img.haomeiwen.com/i7917568/a6009a54359a36cd.png)
![](https://img.haomeiwen.com/i7917568/e34cff6aa795a921.png)
![](https://img.haomeiwen.com/i7917568/67b5c14e9c20fefd.png)
![](https://img.haomeiwen.com/i7917568/3cf2391a276205be.png)
8.3执行root.sh 之前,在所有节点安装p18370031_112040_Linux-x86-64.zip:
NOTE : Before running root.sh, you have to install patch 18370031. This patch is required, because in Linux 7 the init system was changed from ‘SysVinit’ to ‘systemd’. And the patch delivers the necessary changes so that the start procedure of the Grid Infrastructure, which was originally prepared for SysVinit, can be integrated in the new init system.
unzip p18370031_112040_Linux-x86-64.zip
cd 18370031/
/u01/app/11.2.0/grid/OPatch/opatch apply
[root@node1 scripts]# sh /u01/app/11.2.0.4/grid/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0.4/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
root wallet
root wallet cert
root cert export
peer wallet
profile reader wallet
pa wallet
peer wallet keys
pa wallet keys
peer cert request
pa cert request
peer cert
pa cert
peer root cert TP
profile reader root cert TP
pa root cert TP
peer pa cert TP
pa peer cert TP
profile reader pa cert TP
profile reader peer cert TP
peer user cert
pa user cert
Adding Clusterware entries to oracle-ohasd.service
CRS-2672: Attempting to start 'ora.mdnsd' on 'node1'
CRS-2676: Start of 'ora.mdnsd' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'node1'
CRS-2676: Start of 'ora.gpnpd' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'node1'
CRS-2672: Attempting to start 'ora.gipcd' on 'node1'
CRS-2676: Start of 'ora.cssdmonitor' on 'node1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'node1'
CRS-2672: Attempting to start 'ora.diskmon' on 'node1'
CRS-2676: Start of 'ora.diskmon' on 'node1' succeeded
CRS-2676: Start of 'ora.cssd' on 'node1' succeeded
ASM created and started successfully.
Disk Group GRIDDG created successfully.
clscfg: -install mode specified
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4256: Updating the profile
Successful addition of voting disk 159624448ae44f06bfed3b2fb6adf60a.
Successfully replaced voting disk group with +GRIDDG.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 159624448ae44f06bfed3b2fb6adf60a (/dev/asm-diskc) [GRIDDG]
Located 1 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'node1'
CRS-2676: Start of 'ora.asm' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.GRIDDG.dg' on 'node1'
CRS-2676: Start of 'ora.GRIDDG.dg' on 'node1' succeeded
[root@node1 scripts]# sh /u01/app/11.2.0.4/grid/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0.4/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
root wallet
root wallet cert
root cert export
peer wallet
profile reader wallet
pa wallet
peer wallet keys
pa wallet keys
peer cert request
pa cert request
peer cert
pa cert
peer root cert TP
profile reader root cert TP
pa root cert TP
peer pa cert TP
pa peer cert TP
profile reader pa cert TPConfigure Oracle Grid Infrastructure for a Cluster ... succeeded
依次在node2,node3节点执行root.sh脚本
![](https://img.haomeiwen.com/i7917568/e3e617c0763699e8.png)
![](https://img.haomeiwen.com/i7917568/c644fb8f1e7f4026.png)
8.4使用asmca命令创建DATA和FLASH磁盘组
![](https://img.haomeiwen.com/i7917568/ef7f270662cc12ea.png)
![](https://img.haomeiwen.com/i7917568/dc47f27f3901ab3c.png)
![](https://img.haomeiwen.com/i7917568/90c4ca5b22396e67.png)
9. 安装oracle软件并创建数据库
![](https://img.haomeiwen.com/i7917568/b72b73bd528c5ce2.png)
![](https://img.haomeiwen.com/i7917568/64fca5c1f3fbcbec.png)
![](https://img.haomeiwen.com/i7917568/7abca1d2a5970c01.png)
![](https://img.haomeiwen.com/i7917568/17d5f9682a65e2f4.png)
![](https://img.haomeiwen.com/i7917568/5c9f7a7a28b3e7a3.png)
![](https://img.haomeiwen.com/i7917568/e1cc6f6cfdec7186.png)
![](https://img.haomeiwen.com/i7917568/fdcc6073e8033255.png)
![](https://img.haomeiwen.com/i7917568/ca96d5a311a6f78d.png)
![](https://img.haomeiwen.com/i7917568/4c1f505d15c96444.png)
![](https://img.haomeiwen.com/i7917568/3d90804806948a67.png)
![](https://img.haomeiwen.com/i7917568/d10eede05cd47efd.png)
[oracle@node1 ~]$ cd $ORACLE_HOME/sysman/lib
[oracle@node1 lib]$ cp ins_emagent.mk ins_emagent.mk.bak
[oracle@node1 lib]$ vim ins_emagent.mk
SQL
#===========================
# emdctl
#===========================
$(SYSMANBIN)emdctl:
$(MK_EMAGENT_NMECTL) -lnnz11 在此处修改添加
#===========================
# nmocat
#===========================
在后面追加参数-lnnz11, 第一个是字母l,后面两个是数字1。
![](https://img.haomeiwen.com/i7917568/f27b45558bb14e45.png)
![](https://img.haomeiwen.com/i7917568/cbf40155f6e4a542.png)
![](https://img.haomeiwen.com/i7917568/65e9d8a57e71bd15.png)
![](https://img.haomeiwen.com/i7917568/f4dc16d759817f7f.png)
![](https://img.haomeiwen.com/i7917568/b2e4428c8dbaaaef.png)
![](https://img.haomeiwen.com/i7917568/62df0ba8742b0f53.png)
![](https://img.haomeiwen.com/i7917568/f533326e542d973a.png)
![](https://img.haomeiwen.com/i7917568/64278c9583cebab7.png)
![](https://img.haomeiwen.com/i7917568/0b3b79bfb0a25ca4.png)
![](https://img.haomeiwen.com/i7917568/88ca66bac4fc33fa.png)
10.检查集群状态
![](https://img.haomeiwen.com/i7917568/3b052efd8bef0213.png)
11.打补丁
打最新补丁p31720783_112040_Linux-x86-64.zip