rhel 7.6 安装 oracle 18c rac
第一部分 安装规划
虚拟环境 |
virtualbox 6.0 |
os 版本 |
red hat enterprise linux server release 7.6 (maipo) |
数据库版本 |
18.3.0.0.0 |
安装介质 |
linux.x64_180000_db_home.zip linux.x64_180000_grid_home.zip |
软件安装目录 |
grid: /u01/app/18.0.0/grid |
oracle: /u01/app/oracle/product/18.0.0/db_1 |
|
用户和组 |
grid: oinstall,asmadmin,asmdba,racdba,asmoper |
oracle: oinstall, dba,asmdba,backupdba,dgdba,kmdba,racdba,oper |
|
网络规划 |
192.168.56.11 rac1 #一节点public ip 192.168.56.12 rac2 #二节点public ip
192.168.56.13 rac1-vip #一节点virtual ip 192.168.56.14 rac2-vip #二节点virtual ip
172.16.56.11 rac1-priv #一节点private ip 172.16.56.12 rac2-priv #二节点private ip
192.168.56.15 rac-scan # scan ip |
asm磁盘组 |
ocrvt: 2g * 3 mgmt: 40g * 1 data: 8g * 1 arch: 5g * 1 |
安装操作系统,添加asm共享磁盘省略
第二分部 操作系统环境配置
2.1 更改io调度为deadline,关闭numa和透明大页
(1).vi /etc/default/grub(编辑 /etc/default/grub 文件,在grub_cmdline_linux 条目后面添加”elevator=deadline”,”transparent_hugepage=never” 和”numa=off”,
执行grub2-mkconfig -o /boot/grub2/grub.cfg 最后重启操作系统)
grub_cmdline_linux=”crashkernel=auto rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rhgb quiet elevator=deadline transparent_hugepage=never numa=off net.ifnames=0 biosdevname=0″
grub2-mkconfig -o /boot/grub2/grub.cfg
(2). 重启操作系统使配置生效.
2.2 使用ctss时钟同步
/sbin/service ntpd stop
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.org
systemctl stop chronyd
systemctl disable chronyd
2.3 配置/etc/hosts解析表
vi /etc/hosts添加
#config for 18c rac
192.168.56.11 rac1
192.168.56.12 rac2
192.168.56.13 rac1-vip
192.168.56.14 rac2-vip
172.16.56.11 rac1-priv
172.16.56.12 rac2-priv
192.168.56.15 rac-scan
2.4 关闭防火墙
systemctl disable firewalld.service
systemctl stop firewalld.service
2.5 关闭selinux
vi /etc/selinux/config
selinux=disabled
2.6 关闭networkmanager
systemctl disable networkmanager
systemctl stop networkmanager
2.7 停止avahi-daemon
systemctl stop avahi-daemon.socket avahi-daemon.service
systemctl disable avahi-daemon.socket avahi-daemon.service
2.8 配置nozeroconf
vi /etc/sysconfig/network 添加
nozeroconf=yes
2.9 内核参数修改
vi /etc/sysctl.conf
#kernel configuration for oracle 18c
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 268435456
kernel.shmmax = 549755813760
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
2.10 添加用户和组
/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 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/useradd -u 54321 -g oinstall -g dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
/usr/sbin/useradd -u 54322 -g oinstall -g asmadmin,asmdba,racdba,asmoper grid
echo oracle | passwd –stdin oracle
echo oracle | passwd –stdin grid
2.11 创建软件安装目录
mkdir -p /u01/app/18.0.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle/product/18.0.0/db_1
chown -r grid:oinstall /u01
chown -r oracle:oinstall /u01/app/oracle
chmod -r 775 /u01/
2.12 用户环境变量配置
#为grid用户添加环境变量
vi /home/grid/.bash_profile eof
export oracle_base=/u01/app/grid
export oracle_sid=+asm1 (节点2改为+asm2)
export oracle_home=/u01/app/18.0.0/grid
export path=$oracle_home/bin:$path
export ld_library_path=$oracle_home/lib:$ld_library_path
eof
source /home/grid/.bash_profile
#为oracle用户添加环境变量
vi /home/oracle/.bash_profile
export oracle_base=/u01/app/oracle
export oracle_sid=racdb1(节点2改为racdb2)
export oracle_home=$oracle_base/product/18.0.0/db_1
export path=$oracle_home/bin:$path
export ld_library_path=$oracle_home/lib:$ld_library_path
export nls_lang=american_america.zhs16gbk
eof
source /home/oracle/.bash_profile
2.13 配置用户资源限制
vi /etc/security/limits.conf 添加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard memlock 3145728
oracle soft memlock 3145728
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard memlock 3145728
grid soft memlock 3145728
vi /etc/pam.d/login 添加
#this is for oracle user
session required pam_limits.so
2.14 配置全局profile
vi /etc/profile 添加
#this is for oracle user
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
2.15 安装rpm依赖包
yum -y install bc \
binutils \
compat-libcap1 \
compat-libstdc++-33.i686 \
compat-libstdc++-33.x86_64 \
glibc.i686 \
glibc.x86_64 \
glibc-devel.i686 \
glibc-devel.x86_64 \
ksh \
libaio.i686 \
libaio.x86_64 \
libaio-devel.i686 \
libaio-devel.x86_64 \
libx11.i686 \
libx11.x86_64 \
libxau.i686 \
libxau.x86_64 \
libxi.i686 \
libxi.x86_64 \
libxtst.i686 \
libxtst.x86_64 \
libxrender-devel.i686 \
libxrender-devel.x86_64 \
libxrender.i686 \
libxrender.x86_64 \
libgcc.i686 \
libgcc.x86_64 \
libstdc++.i686 \
libstdc++.x86_64 \
libstdc++-devel.i686 \
libstdc++-devel.x86_64 \
libxcb.i686 \
libxcb.x86_64 \
make \
nfs-utils.x86_64 \
net-tools \
python \
python-configshell \
python-rtslib \
python-six \
smartmontools \
sysstat \
targetcli \
unixodbc \
unixodbc-devel \
unzip
cvuqdisk_grp=oinstall; export cvuqdisk_grp
rpm -iv /u01/app/18.0.0/grid/cvuqdisk-1.0.10-1.rpm (需先解压grid安装包到/u01/app/18.0.0/grid)
2.16 共享存储配置
(1).多路径方式安装配置
yum -y install device-mapper*
–生成默认配置文件
mpathconf –enable
vi /etc/multipath.conf 修改
find_multipaths no
multipaths {
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754171
alias ocr1
}
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754172
alias ocr2
}
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754173
alias ocr3
}
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754174
alias mgmt
}
multipath {
wwid 14f504e46494c4552325354736c632d783567742d47557662
alias data
}
multipath {
wwid 14f504e46494c45526a62644c70392d65744b562d38524967
alias arch
}
}
multipath -f
systemctl restart multipathd.service
multipath -v3
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
kernel==”dm-*”,env{dm_uuid}==”mpath-14f504e46494c455257374a5968312d784f45542d54754171″,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”dm-*”,env{dm_uuid}==”mpath-14f504e46494c455257374a5968312d784f45542d54754172″,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”dm-*”,env{dm_uuid}==”mpath-14f504e46494c455257374a5968312d784f45542d54754173″,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”dm-*”,env{dm_uuid}==”mpath-14f504e46494c455257374a5968312d784f45542d54754174″,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”dm-*”,env{dm_uuid}==”mpath-14f504e46494c4552325354736c632d783567742d47557662″,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”dm-*”,env{dm_uuid}==”mpath-14f504e46494c45526a62644c70392d65744b562d38524967″,owner=”grid”,group=”asmadmin”,mode=”0660″
udevadm trigger
udevadm control -r
systemctl restart systemd-udevd.service
(2).不使用多路径的方式,仅需配置如下文件(本次安装是测试环境,磁盘没有多条路径,无需使用多路径方式)
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
kernel==”sd?”,subsystem==”block”,program==”/usr/lib/udev/scsi_id –whitelisted –replace-whitespace –device=/dev/$name”,result==”1ata_vbox_harddisk_vb5643659c-65a9d79a”,symlink+=”asm-diskb”,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”sd?”,subsystem==”block”,program==”/usr/lib/udev/scsi_id –whitelisted –replace-whitespace –device=/dev/$name”,result==”1ata_vbox_harddisk_vb603d9ec9-7c3a2db0″,symlink+=”asm-diskc”,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”sd?”,subsystem==”block”,program==”/usr/lib/udev/scsi_id –whitelisted –replace-whitespace –device=/dev/$name”,result==”1ata_vbox_harddisk_vbc74f578a-aa1a566c”,symlink+=”asm-diskd”,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”sd?”,subsystem==”block”,program==”/usr/lib/udev/scsi_id –whitelisted –replace-whitespace –device=/dev/$name”,result==”1ata_vbox_harddisk_vbcje8jg2a-ff4e14d3″,symlink+=”asm-diske”,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”sd?”,subsystem==”block”,program==”/usr/lib/udev/scsi_id –whitelisted –replace-whitespace –device=/dev/$name”,result==”1ata_vbox_harddisk_vbcaeggcdb-3gv5hnc6″,symlink+=”asm-diskf”,owner=”grid”,group=”asmadmin”,mode=”0660″
kernel==”sd?”,subsystem==”block”,program==”/usr/lib/udev/scsi_id –whitelisted –replace-whitespace –device=/dev/$name”,result==”1ata_vbox_harddisk_vbccbd112b-egdgrkr5″,symlink+=”asm-diskg”,owner=”grid”,group=”asmadmin”,mode=”0660″
#使udev策略配置生效
udevadm trigger
udevadm control -r
systemctl restart systemd-udevd.service
[root@rac1 ~]# ll /dev/asm*
lrwxrwxrwx 1 root root 3 mar 25 14:53 /dev/asm-diskb -> sdb
lrwxrwxrwx 1 root root 3 mar 25 14:53 /dev/asm-diskc -> sdc
lrwxrwxrwx 1 root root 3 mar 25 15:06 /dev/asm-diskd -> sdd
lrwxrwxrwx 1 root root 3 mar 25 15:06 /dev/asm-diske -> sde
lrwxrwxrwx 1 root root 3 mar 25 15:06 /dev/asm-diskf -> sdf
[root@rac1 ~]# ll /dev/sd*
brw-rw—- 1 grid asmadmin 8, 16 mar 25 15:07 /dev/sdb
brw-rw—- 1 grid asmadmin 8, 32 mar 25 15:07 /dev/sdc
brw-rw—- 1 grid asmadmin 8, 48 mar 25 15:07 /dev/sdd
brw-rw—- 1 grid asmadmin 8, 64 mar 25 15:07 /dev/sde
brw-rw—- 1 grid asmadmin 8, 80 mar 25 15:07 /dev/sdf
第三部分 安装grid软件
3.1 解压软件
unzip linux.x64_180000_grid_home.zip -d /u01/app/18.0.0/grid
3.2 配置用户ssh对等性(方便检查rac2节点配置,也可以oui界面配置)
su – grid
cd /u01/app/18.0.0/grid/oui/prov/resources/scripts
./sshusersetup.sh -user grid -hosts “rac1 rac2” -advanced –nopromptpassphrase
3.3 安装前环境预检查
su – grid
cd /u01/app/18.0.0/grid
./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup –verbose
3.4 开始安装grid软件
export display=192.168.56.1:0.0
cd /u01/app/18.0.0/grid
./gridsetup.sh
分别在rac1,rac2执行上面2个脚本
执行完成后,点击ok继续完成安装。
ins-20802 报错可以忽略
至此grid软件安装完成。
第四部分 创建asm磁盘组
su – grid
export display=192.168.56.1:0.0
asmca
创建data和arch磁盘组
第五部分 安装database软件
5.1 解压db软件
su – oracle
unzip /soft/linux.x64_180000_db_home.zip –d /u01/app/oracle/product/18.0.0/db_1
5.2 开始安装db软件
su – oracle
export display=192.168.56.1:0.0
cd /u01/app/oracle/product/18.0.0/db_1
./runinstaller
如果前面没有配置oracle用户的ssh对等性,则输入oracle用户密码,点击setup进行配置
分别在rac1,rac2节点执行/u01/app/oracle/product/18.0.0/db_1/root.sh脚本
至此database软件安装完成。
第六部分 创建数据库
su – oracle
export display=192.168.56.1:0.0
dbca
至此dbca创建数据库完成。