代码改变世界

Linux平台 Oracle 18c RAC安装Part1:准备工作

2018-08-04 22:20 AlfredZhao 阅读(...) 评论(...) 编辑 收藏

一、实施前期准备工作

二、安装前期准备工作

Linux平台 Oracle 18c RAC安装指导:
Part1:Linux平台 Oracle 18c RAC安装Part1:准备工作
Part2:Linux平台 Oracle 18c RAC安装Part2:GI配置
Part3:Linux平台 Oracle 18c RAC安装Part3:DB配置

本文安装环境:OEL 7.5 + Oracle 18.3 GI & RAC

一、实施前期准备工作

1.1 服务器安装操作系统

配置完全相同的两台服务器,安装相同版本的Linux操作系统。留存系统光盘或者镜像文件。
我这里是OEL7.5,系统目录大小均一致。对应OEL7.5的系统镜像文件放在服务器上,供后面配置本地yum使用。

1.2 Oracle安装介质

Oracle 18.3 版本2个zip包(总大小9G+,注意空间):
LINUX.X64_180000_grid_home.zip MD5: CD42D137FD2A2EEB4E911E8029CC82A9
LINUX.X64_180000_db_home.zip MD5: 99A7C4A088A8A502C261E741A8339AE8
这个自己去Oracle官网下载,然后只需要上传到节点1即可。

1.3 共享存储规划

从存储中划分出两台主机可以同时看到的共享LUN,3个1G的盘用作OCR和Voting Disk,1个40G的盘做GIMR,其余规划做数据盘和FRA。
根据实际需要选择multipath或者udev绑定设备。这里选用multipath绑定。

multipath -ll
multipath -F
multipath -v2
multipath -ll

我这里实验环境,存储划分的LUN是通过一台iSCSI服务器模拟的,下面是服务端主要配置信息:

o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 8]
  | | o- disk1 ...................................................... [/dev/mapper/vg_storage-lv_lun1 (1.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- disk2 ...................................................... [/dev/mapper/vg_storage-lv_lun2 (1.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- disk3 ...................................................... [/dev/mapper/vg_storage-lv_lun3 (1.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- disk4 ..................................................... [/dev/mapper/vg_storage-lv_lun4 (40.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- disk5 ..................................................... [/dev/mapper/vg_storage-lv_lun5 (10.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- disk6 ..................................................... [/dev/mapper/vg_storage-lv_lun6 (10.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- disk7 ..................................................... [/dev/mapper/vg_storage-lv_lun7 (10.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- disk8 ..................................................... [/dev/mapper/vg_storage-lv_lun8 (16.0GiB) write-thru activated]
  | |   o- alua ................................................................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 1]
  | o- iqn.2003-01.org.linux-iscsi.storage-c.x8664:sn.bc3a6511567c ....................................................... [TPGs: 1]
  |   o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
  |     o- acls .......................................................................................................... [ACLs: 1]
  |     | o- iqn.2003-01.org.linux-iscsi.storage-c.x8664:sn.bc3a6511567c:client ................................... [Mapped LUNs: 8]
  |     |   o- mapped_lun0 ................................................................................. [lun0 block/disk1 (rw)]
  |     |   o- mapped_lun1 ................................................................................. [lun1 block/disk2 (rw)]
  |     |   o- mapped_lun2 ................................................................................. [lun2 block/disk3 (rw)]
  |     |   o- mapped_lun3 ................................................................................. [lun3 block/disk4 (rw)]
  |     |   o- mapped_lun4 ................................................................................. [lun4 block/disk5 (rw)]
  |     |   o- mapped_lun5 ................................................................................. [lun5 block/disk6 (rw)]
  |     |   o- mapped_lun6 ................................................................................. [lun6 block/disk7 (rw)]
  |     |   o- mapped_lun7 ................................................................................. [lun7 block/disk8 (rw)]
  |     o- luns .......................................................................................................... [LUNs: 8]
  |     | o- lun0 ................................................ [block/disk1 (/dev/mapper/vg_storage-lv_lun1) (default_tg_pt_gp)]
  |     | o- lun1 ................................................ [block/disk2 (/dev/mapper/vg_storage-lv_lun2) (default_tg_pt_gp)]
  |     | o- lun2 ................................................ [block/disk3 (/dev/mapper/vg_storage-lv_lun3) (default_tg_pt_gp)]
  |     | o- lun3 ................................................ [block/disk4 (/dev/mapper/vg_storage-lv_lun4) (default_tg_pt_gp)]
  |     | o- lun4 ................................................ [block/disk5 (/dev/mapper/vg_storage-lv_lun5) (default_tg_pt_gp)]
  |     | o- lun5 ................................................ [block/disk6 (/dev/mapper/vg_storage-lv_lun6) (default_tg_pt_gp)]
  |     | o- lun6 ................................................ [block/disk7 (/dev/mapper/vg_storage-lv_lun7) (default_tg_pt_gp)]
  |     | o- lun7 ................................................ [block/disk8 (/dev/mapper/vg_storage-lv_lun8) (default_tg_pt_gp)]
  |     o- portals .................................................................................................... [Portals: 1]
  |       o- 0.0.0.0:3260 ..................................................................................................... [OK]
  o- loopback ......................................................................................................... [Targets: 0]
/> 

关于这部分相关的知识点可以参考之前的文章:

关于udev + multipath 的最简配置(可在后续创建用户后操作):

# vi /etc/udev/rules.d/12-dm-permissions.rules
ENV{DM_UUID}=="mpath-?*", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
# udevadm control --reload
# udevadm trigger

1.4 网络规范分配

公有网络 以及 私有网络。
公有网络:这里实验环境是enp0s3是public IP,enp0s8是private IP,enp0s9和enp0s10是用于模拟IPSAN的两条网络。实际生产需根据实际情况调整规划。

二、安装前期准备工作

2.1 各节点系统时间校对

各节点系统时间校对:

--检验时间和时区确认正确
date 

--关闭chrony服务,移除chrony配置文件(后续使用ctss)
systemctl list-unit-files|grep chronyd
systemctl status chronyd

systemctl disable chronyd
systemctl stop chronyd

mv /etc/chrony.conf /etc/chrony.conf_bak

这里实验环境,选择不使用NTP和chrony,这样Oracle会自动使用自己的ctss服务。

2.2 各节点关闭防火墙和SELinux

各节点关闭防火墙:

systemctl list-unit-files|grep firewalld
systemctl status firewalld

systemctl disable firewalld
systemctl stop firewalld

各节点关闭SELinux:

getenforce
cat /etc/selinux/config

手工修改/etc/selinux/config SELINUX=disabled,或使用下面命令:
sed -i '/^SELINUX=.*/ s//SELINUX=disabled/' /etc/selinux/config
setenforce 0

最后核实各节点已经关闭SELinux即可。

2.3 各节点检查系统依赖包安装情况

yum install -y oracle-database-server-12cR2-preinstall.x86_64

在OEL7.5中还是12cR2-preinstall的名字,并没有对应18c的,但实际测试,在依赖包方面基本没区别。
如果选用的是其他Linux,比如常用的RHEL,那就需要yum安装官方文档要求的依赖包了。

2.4 各节点配置/etc/hosts

编辑/etc/hosts文件:

#public ip
192.168.1.40  db40
192.168.1.42  db42
#virtual ip
192.168.1.41  db40-vip
192.168.1.43  db42-vip
#scan ip
192.168.1.44  db18c-scan

#private ip
10.10.1.40    db40-priv
10.10.1.42    db42-priv

2.5 各节点创建需要的用户和组

创建group & user,给oracle、grid设置密码:

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,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle  
useradd -u 54322 -g oinstall -G asmadmin,asmdba,asmoper,dba grid  

echo oracle | passwd --stdin oracle
echo oracle | passwd --stdin grid

我这里测试环境设置密码都是oracle,实际生产环境建议设置符合规范的复杂密码。

2.6 各节点创建安装目录

各节点创建安装目录(root用户):

mkdir -p /u01/app/18.3.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle
chown -R grid:oinstall /u01
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/

2.7 各节点系统配置文件修改

内核参数修改:vi /etc/sysctl.conf
实际上OEL在安装依赖包的时候也同时修改了这些值,以下参数主要是核对或是对RHEL版本作为参考:

# vi /etc/sysctl.conf  增加如下内容:

vm.swappiness = 1
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
kernel.shmmni = 4096  
kernel.shmall = 1073741824  
kernel.shmmax = 4398046511104
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 
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.panic_on_oops = 1
net.ipv4.conf.enp0s8.rp_filter = 2
net.ipv4.conf.enp0s9.rp_filter = 2
net.ipv4.conf.enp0s10.rp_filter = 2

修改生效:

#sysctl -p /etc/sysctl.conf

注:enp0s9和enp0s10是IPSAN专用的网卡,跟私网一样设置loose mode。

#sysctl -p /etc/sysctl.d/98-oracle.conf
net.ipv4.conf.enp0s8.rp_filter = 2
net.ipv4.conf.enp0s9.rp_filter = 2
net.ipv4.conf.enp0s10.rp_filter = 2

用户shell的限制:vi /etc/security/limits.d/99-grid-oracle-limits.conf

oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768

这里需要注意OEL自动配置的 /etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf 并不包含grid用户的,可以手工加上。

vi /etc/profile.d/oracle-grid.sh

#Setting the appropriate ulimits for oracle and grid user
if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
 ulimit -u 16384 
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
fi
if [ $USER = "grid" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
 ulimit -u 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
fi

这个OEL中也没有自动配置,需要手工配置。

2.8 各节点设置用户的环境变量

第1个节点grid用户:

export ORACLE_SID=+ASM1;
export ORACLE_BASE=/u01/app/grid;
export ORACLE_HOME=/u01/app/18.3.0/grid;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

第2个节点grid用户:

export ORACLE_SID=+ASM2;
export ORACLE_BASE=/u01/app/grid;
export ORACLE_HOME=/u01/app/18.3.0/grid;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

第1个节点oracle用户:

export ORACLE_SID=cdb1;
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=/u01/app/oracle/product/18.3.0/db_1;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

第2个节点oracle用户:

export ORACLE_SID=cdb2;
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=/u01/app/oracle/product/18.3.0/db_1;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;