rac 节点规划
节点 | 主机名 | pulic ip | vip | private ip | scan ip |
---|---|---|---|---|---|
rac1 | rac1 | 192.168.5.111 | 192.168.5.101 | 10.10.10.11 | 192.168.5.200 |
rac2 | rac2 | 192.168.5.112 | 192.168.5.102 | 10.10.10.12 |
配置系统环境:
1.配置主机名
2.配置IP地址
nmtui
3.同步系统时间
root@rac2 ~]# ntpdate ntp.aliyun.com
[root@rac1 ~]# ntpdate ntp.aliyun.com
crontal -e
*/12 * * * * /usr/sbin/ntpdate -u ntp.aliyun.com >/dev/null ;hwclock -w
4.添加网卡
2块网卡
5.关闭防火墙
[root@rac1 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@rac1 ~]# systemctl stop firewalld.service
6.关闭selinux
vi /etc/selinux/config
SELINUX=disabled
7.配置/etc/hosts
vi /etc/hosts
#Public
192.168.5.111 rac1
192.168.5.112 rac2
#Virtual
192.168.5.101 rac1-vip
192.168.5.102 rac2-vip
#Private
10.10.10.11 rac1-priv
10.10.10.12 rac2-priv
#Scan-ip
192.168.5.200 rac-scan
8.配置资源限制limits.conf
vi /etc/security/limits.conf
oracle 预配置编辑 vi /etc/security/limits.d/oracle-database-preinstall-19c.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 3145728
oracle hard stack 3145728
oracle soft memlock 3145728
oracle hard memlock 3145728
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
9.配置/dev/shm
推荐配置为生产环境ram的80%
df -h
vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=6g 0 0
mount -o remount /dev/shm
10.配置内核参数
使用oracle 预配置则忽略此步骤
touch /etc/sysctl.d/97-oracledatabase-sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 1572864
kernel.shmmax = 6442450944
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 --system(立即生效)
sysctl -a|grep shmmax
sysctl -a|grep shmall
11.添加账户
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
useradd -u 54322 -g oinstall -G dba,asmoper,asmadmin,asmdba grid
useradd -u 54321 -g oinstall -G dba,oper,asmdba,asmadmin oracle
passwd grid
passwd oracle
id oracle
id grid
2个节点的用户号必须一样
--------------------------------------------
预配置追加用户
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
useradd -u 54322 -g oinstall -G asmadmin,asmdba,racdba,asmoper grid
/usr/sbin/usermod -g oinstall -G asmadmin,asmdba,racdba,asmoper grid
/usr/sbin/usermod -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
---------------------------------------------------
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
12.创建目录
mkdir -p /opt/app/grid
mkdir -p /opt/app/12.2.0.1/grid
mkdir -p /opt/app/oracle/product/12.2.0.1/dbhome_1
chown -R oracle:oinstall /opt
chown -R grid:oinstall /opt/app/grid
chown -R oracle:oinstall /opt/app/oracle
chown -R grid:oinstall /opt/app/12.2.0.1
chmod -R 775 /opt
13.配置环境变量
Grid Infrastructure
.bash_profile
export ORACLE_SID=+ASM1
export ORACLE_BASE=/opt/app/grid
export ORACLE_HOME=/opt/app/12.2.0.1/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=+ASM2
export ORACLE_BASE=/opt/app/grid
export ORACLE_HOME=/opt/app/12.2.0.1/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
Oracle Database
.bash_profile
export ORACLE_SID=racdb1
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/product/12.2.0.1/db_1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=racdb2
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/product/12.2.0.1/db_1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
14.修改/etc/nsswitch.conf
修改行
hosts: files dns myhostname
为
hosts: files dns nis
15.关闭透明大页
https://www.yuque.com/yongle-okrsc/kb/abnl9t#ifioW
16.网卡名更改
在 /etc/sysconfig/network-scripts/ 文件夹下
cp ifcfg-ens33 ifcfg-eth0
删除 uid 修改设备名和网卡名 设置规划的public ip 地址
cp ifcfg-eth0 ifcfg-eth1 设置规划的private ip 地址
vi /etc/sysconfig/grub 下的GRUB_COMLINE_LINUX="" 中添加 net.ifnames=0 biosdevname=0
grub2-mkconfig -o /boot/grub2/grub.cfg
ip addr 查看mac地址
编辑/etc/udev/rules.d/70-persistent-ipoib.rules 文件,
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="00:0c:29:0f:93:49", NAME="eth0"
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="00:0c:29:0f:93:53", NAME="eth1"
reboot
17.禁止ntp服务
centos 7
systemctl stop chronyd
systemctl disable chronyd
centos 6 mv /etc/chrony.conf /etc/chrony.conf.bak
18.禁止avahi-daemon服务
avahi-daemon 服务会影响 oracle的多波通信,进而导致节点重启
systemctl stop avahi-daemon.service
systemctl disable avahi-daemon.service
19.配置network文件
vi /etc/sysconfig/network
NOZEROCONF=yes
20.添加共享磁盘
21.配置共享磁盘
vm 虚拟机2 编辑追加 vmx文件
disk.locking="FALSE"
scsi1:0.SharedBus="Virtual"
disk.EnableUUID = "TRUE"
scsi1:1.SharedBus="Virtual"
/lib/udev/scsi_id -g -d /dev/sdc 查看硬盘uuid
创建99-oracle-asmdevices.rules文件
touch /etc/udev/rules.d/99-oracle-asmdevices.rules
未分区
第1种方式:
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29f1e44953dc3bf6bde7ff61fd1", RUN+="/bin/sh -c 'mknod /dev/asmdisk1 b $major $minor; chown grid:asmadmin /dev/asmdisk1; chmod 0660 /dev/asmdisk1'"
KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29316b5d859ce2fee1ab6c622f5", RUN+="/bin/sh -c 'mknod /dev/asmdisk2 b $major $minor; chown grid:asmadmin /dev/asmdisk2; chmod 0660 /dev/asmdisk2'"
第2种方式:
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29f1e44953dc3bf6bde7ff61fd1", SYMLINK+="asmdisk1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29316b5d859ce2fee1ab6c622f5", SYMLINK+="asmdisk2", OWNER="grid", GROUP="asmadmin", MODE="0660"
emc 多路径
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf098002b63924885640ab7f028cb",SYMLINK+="oraocr1",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf09800c53619469a17fd57fa1e8a",SYMLINK+="oraocr2",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf098008c8042a8c7f47d8c9e7d06",SYMLINK+="oraocr3",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf09800038785466f37877d4ff1f3",SYMLINK+="oraocr4",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf098004a1e52ca193b167d7ab352",SYMLINK+="oraocr5",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf098009bdc2a2adedd77dd1fef9e",SYMLINK+="oraarch",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf09800b3ee2ffef4ce980c7ff1de",SYMLINK+="oradata",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-368ccf0980034683d967bbc832279d91f",SYMLINK+="oramgmt",OWNER="grid",GROUP="asmadmin",MODE="0660"
重启UDEV:
systemctl restart systemd-udevd.service
udevadm control --reload-rules
/sbin/udevadm trigger --type=devices --action=add
/sbin/udevadm trigger --type=devices --action=change
重新安装rac 格式化硬盘
mkfs -t /dev/sdb
mkfs -t /dev/sdc
dd if=/dev/zero of=/dev/sdc bs=1024 count=512
dd if=/dev/zero of=/dev/sdb bs=1024 count=512
ls /dev 查看新添加的磁盘
22.安装cvuqdisk
rpm -ivh /opt/app/12.2.0.1/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm