1 准备工作
1.软件需求
rpm -q make binutils
fontconfig-devel glibc glibc-devel ksh libaio libaio-devel
libXrender-devel libgcc libstdc++ libstdc++-devel libxcb net-tools nfs-utils smartmontools
compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel
libXau libXtst libXrender
libXll
libXi
配置 yum 安装缺失包
2.网络需求
各节点配置网卡
每个节点至少要有两个网络适配器(网卡)或者是两个网络接口卡(NICs),一个用于公有网络,
一个用于私有网络。
在 11.2.0.2 版本之后,可以使用 Redundant Interconnect Usage 创建 1-4 个高可用 IP(HAIP),实现
节点之间私有网络的高可用和负载均衡。
3.划分节点 IP(各节点)
[root@racdb1 yum.repos.d]# vi
127.0.0.1
::1
localhost localhost.localdomain localhost4 localhost4.localdomain4
localhost localhost.localdomain localhost6 localhost6.localdomain6
/etc/hosts
## Public
192.168.0.26 racdb1
192.168.0.27 racdb2
#Virtual IP
192.168.0.28 racdb1vip
192.168.0.29 racdb2vip
#Private IP
10.10.0.202 racdb1pri
10.10.0.203 racdb2pri
#Scan Virtual IP
192.168.0.33 rac-scan
4.防火墙和 Selinux(各节点)
[root@racdb1 ~]# systemctl stop firewalld.service
[root@racdb1 ~]# systemctl disable firewalld.service
[root@racdb1 ~]# getenforce
[root@racdb1 ~]# vi /etc/selinux/config
[root@racdb1 ~]# vi /etc/selinux/config
SELINUX=disabled
保存重启
5.创建组和用户(各节点)
groupadd -g 1022 asmoper
groupadd -g 1020 asmadmin
groupadd -g 1021 asmdba
groupadd -g 1010 oinstall
groupadd -g 1030 dba
groupadd -g 1031 oper
/usr/sbin/useradd -u 1101 -g oinstall -G dba,oper,asmdba,asmoper oracle
echo oracle | passwd --stdin oracle
/usr/sbin/useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba
echo grid | passwd --stdin grid
grid
6.创建安装目录(各节点)
mkdir -p /oracle/app/11.2.0/grid
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/oracle
mkdir -p /oracle/software
chown -R grid:oinstall /oracle
chown oracle:oinstall /oracle/app/oracle
chmod -R 775 /oracle
注意:
Grid home 一定不要放置在 Oracle BASE 目录下,包括 Grid 用户的 BASE 目录
并且也不能放置在安装用户的 home 目录下
如果 Grid home 路径在安装过程中的权限变为 root,那么在其他安装中将会发生错误
7.配置安装用户的环境变量(各节点)
ORALCE 用户
racdb1:
export PATH
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=JYSDB1
export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
[oracle@racdb1 ~]$ . ./.bash_profile
racdb2:
export PATH
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=JYSDB2
export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
[oracle@racdb2 ~]$ . ./.bash_profile
grid 用户
racdb1:
export PATH
export ORACLE_BASE=/oracle/app/grid
export ORACLE_HOME=/oracle/app/11.2.0/grid
export ORACLE_SID=+ASM1
export PATH=.:$ORACLE_HOME/bin:$PATH
racdb2:
export ORACLE_BASE=/oracle/app/grid
export ORACLE_HOME=/oracle/app/11.2.0/grid
export ORACLE_SID=+ASM2
export PATH=.:$ORACLE_HOME/bin:$PATH
~
[root@racdb2 ~]# . ./.bash_profile
8.资源限制(各节点)
soft
hard
soft
hard
soft
vi /etc/security/limits.conf
oracle
oracle
oracle
oracle
oracle
grid
grid
grid
grid
grid
soft
hard
soft
hard
soft
2047
16384
nproc
nproc
nofile 1024
nofile 65536
10240
stack
2047
nproc
nproc
16384
nofile 1024
nofile 65536
stack
10240
9.配置 Linux 内核参数
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 131858432
kernel.shmmax = 220200960000
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
sysctl –p
10.修改 pam 登陆验证模块(各节点)
vim /etc/pam.d/login
session
required
pam_limits.so
11.修改/etc/profile 文件(各节点)
vim /etc/profile
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
12.安装介质
[root@racdb1 software]# unzip p13390677_112040_Linux-x86-64_1of7.zip
[root@racdb1 software]# unzip p13390677_112040_Linux-x86-64_2of7.zip
[root@racdb1 software]# unzip p13390677_112040_Linux-x86-64_3of7.zip
13.停用 NTP 服务(各节点)
RAC 中的每个节点都需要有相同的时区,在安装过程中安装进程会自动识别安装用户使用的
时区,并作为 RAC 所有节点的默认时间,也就是 database 和 ASM 的默认时间。
配置时间同步有两个选项,一个是在操作系统层面配置 NTP,或者使用 Oracle Cluster Time
Synchronization Service(OCTSS) OCTSS 是专门为无法访问 NTP 的情况下设计的,如果使用了
NTP,那么 OCTSS 进程(ctssd)将会启动在遵守 observer 模式,如果没有使用 NTP 的话
那么 OCTSS 进程(ctssd)将会启动在激活 active 模式,并且使用的是集群内部的时间,与外界
时间没有任何关系
注意:
在 Oracle Grid Infrastructure 开始安装之前,就要保证所有节点上的时间是相同的
如果在节点上存在 NTP 进程,但是无法通过它来同步时间,从而使用 OCTSS 来进行时间的
同步,那么需要停用和卸载 NTP
停用 NTP 服务进程,必须停止已经存在的 ntpd 服务,从初始化队列中禁用它,并且移除
ntp.conf 文件,停用 NTP 的过程需要使用 root 用户
# systemctl is-enable ntpdate.service
# systemctl disable ntpdate.service
mv /etc/ntp.config /etc/ntp.conf.bak (我这里没有,我就没管它)
rm /var/run/ntpd.pid
14.配置互信
方法一:在 OUI 中完成
方法二:使用脚本配置
此处用方法二吧!
[root@racdb1 software]# su - grid
Last login: Fri Apr 10 14:58:36 CST 2020 on pts/1
[grid@racdb1 ~]$ cd /oracle/software/grid/sshsetup/
[grid@racdb1 sshsetup]$ ./sshUserSetup.sh -user grid -hosts "racdb1 racdb2" -advanced
-noPromptPassphrase
The output of this script is also logged into /tmp/sshUserSetup_2020-04-10-16-08-39.log
Hosts are racdb1 racdb2
user is grid
Platform:- Linux
Checking if the remote hosts are reachable
PING racdb1 (192.168.0.26) 56(84) bytes of data.
64 bytes from racdb1 (192.168.0.26): icmp_seq=1 ttl=64 time=0.032 ms
64 bytes from racdb1 (192.168.0.26): icmp_seq=2 ttl=64 time=0.052 ms
64 bytes from racdb1 (192.168.0.26): icmp_seq=3 ttl=64 time=0.051 ms
64 bytes from racdb1 (192.168.0.26): icmp_seq=4 ttl=64 time=0.052 ms
64 bytes from racdb1 (192.168.0.26): icmp_seq=5 ttl=64 time=0.052 ms
--- racdb1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.032/0.047/0.052/0.011 ms
PING racdb2 (192.168.0.27) 56(84) bytes of data.
64 bytes from racdb2 (192.168.0.27): icmp_seq=1 ttl=64 time=0.441 ms
64 bytes from racdb2 (192.168.0.27): icmp_seq=2 ttl=64 time=0.525 ms
64 bytes from racdb2 (192.168.0.27): icmp_seq=3 ttl=64 time=0.375 ms
64 bytes from racdb2 (192.168.0.27): icmp_seq=4 ttl=64 time=0.328 ms
64 bytes from racdb2 (192.168.0.27): icmp_seq=5 ttl=64 time=0.396 ms
--- racdb2 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.328/0.413/0.525/0.066 ms
Remote host reachability check succeeded.
The following hosts are reachable: racdb1 racdb2.
The following hosts are not reachable: .
All hosts are reachable. Proceeding further...
firsthost racdb1
numhosts 2
The script will setup SSH connectivity from the host racdb1 to all
the remote hosts. After the script is executed, the user can use SSH to run
commands on the remote hosts or copy files between this host racdb1
and the remote hosts without being prompted for passwords or confirmations.
NOTE 1:
As part of the setup procedure, this script will use ssh and scp to copy
files between the local host and the remote hosts. Since the script does not
store passwords, you may be prompted for the passwords during the execution of
the script whenever ssh or scp is invoked.
NOTE 2:
AS PER SSH REQUIREMENTS, THIS SCRIPT WILL SECURE THE USER HOME DIRECTORY
AND THE .ssh DIRECTORY BY REVOKING GROUP AND WORLD WRITE PRIVILEDGES TO THESE
directories.
Do you want to continue and let the script make the above mentioned changes (yes/no)?
yes
/home/grid/.ssh/config,
it would be backed up to
The user chose yes
User chose to skip passphrase related questions.
Creating .ssh directory on local host, if not present already
Creating authorized_keys file on local host
Changing permissions on authorized_keys to 644 on local host
Creating known_hosts file on local host
Changing permissions on known_hosts to 644 on local host
Creating config file on local host
If a config file exists already at
/home/grid/.ssh/config.backup.
Removing old private/public keys on local host
Running SSH keygen on local host with empty passphrase
Generating public/private rsa key pair.
Your identification has been saved in /home/grid/.ssh/id_rsa.
Your public key has been saved in /home/grid/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:seY934bChsODSvqAa3E4aA9eZ5QqeyCgBDFrKVQp/uw grid@racdb1
The key's randomart image is:
+---[RSA 1024]----+
|oo...
|o+..
|=o.
|+o
|= + o
S
|+X * o o .
|= & + o.oo .
| = E
|
|o o.o.
|
+----[SHA256]-----+
Creating .ssh directory and setting permissions on remote host racdb1
THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE
HOME DIRECTORY FOR grid. THIS IS AN SSH REQUIREMENT.
The script would create ~grid/.ssh/config file on remote host racdb1. If a config file exists already
at ~grid/.ssh/config, it would be backed up to ~grid/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host
racdb1.
Warning: Permanently added 'racdb1,192.168.0.26' (ECDSA) to the list of known hosts.
grid@racdb1's password:
Done with creating .ssh directory and setting permissions on remote host racdb1.
. = +o...
+ ....
|
|
|
|
|
|
. .
o
o
|