安装目录
- 一.新建节点
- 1.创建虚拟机rac1
- 2.添加一个iSCSI控制器(总线共享选择虚拟)
- 3.添加一块新的网卡
- 4.添加6块硬盘,大小50G,要设置磁盘置备为‘厚置备,置零’,并且控制器选择新添加的iSCSI控制器,磁盘模式为独立持久
- 5.选择镜像,安装操作系统
- 6.创建虚拟机rac2
- 7.添加一个iSCSI控制器,scsi共享总线选择虚拟
- 8.添加一块新的网卡
- 9.添加硬盘选择现有硬盘,找到rac1对应的的6块硬盘,依次添加,修改iSCSI控制器(同rac1)以及磁盘模式独立持久
- 10.选择镜像,安装操作系统
- 11.选择图形化界面安装 server with GUI
- 12.磁盘配置(按照图片上的配置就行)
- 13.网络配置(两块网卡都需要配置)rac1和rac2都需要配置
- 14.等待安装
- 二.节点配置(rac1和rac2都需要配置)
- 三.安装(rac1上操作)
1.创建虚拟机rac1
2.添加一个iSCSI控制器(总线共享选择虚拟)
3.添加一块新的网卡
4.添加6块硬盘,大小50G,要设置磁盘置备为‘厚置备,置零’,并且控制器选择新添加的iSCSI控制器,磁盘模式为独立持久
5.选择镜像,安装操作系统
6.创建虚拟机rac2
7.添加一个iSCSI控制器,scsi共享总线选择虚拟
8.添加一块新的网卡
9.添加硬盘选择现有硬盘,找到rac1对应的的6块硬盘,依次添加,修改iSCSI控制器(同rac1)以及磁盘模式独立持久
10.选择镜像,安装操作系统
11.选择图形化界面安装 server with GUI
12.磁盘配置(按照图片上的配置就行)
13.网络配置(两块网卡都需要配置)rac1和rac2都需要配置
1.公共网络:(Public IP )公共网络用于连接客户端和应用程序到数据库服务。在Oracle RAC中,公共网络通常使用标准的TCP/IP协议,通过标准的以太网交换机进行通信。公共网络可以使用单独的物理网卡或者虚拟网络接口(VNIC)实现。
2.专用网络:(Private IP)专用网络用于连接Oracle RAC集群中的各个节点之间。在Oracle RAC中,专用网络通常使用InfiniBand或者其他高速互连技术,以实现低延迟、高带宽的数据传输。专用网络可以使用单独的物理网卡或者虚拟网络接口(VNIC)实现。
14.等待安装
1.修改主机名和hosts文件
[root@localhost ~]# hostnamectl set-hostname rac1 #rac也修改名称[root@localhost ~]# vi /etc/hosts
rac2重复操作并把rac1中的hosts文件拷贝过来
修改(private ip)内部网络配置文件
rac1和rac2都操作,修改完成之后,重启网卡
[root@localhost ~]# ifdown ens256Device 'ens256' successfully disconnected.[root@localhost ~]# ifup ens256Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
2.新建账号和组
/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,oper oracle/usr/sbin/useradd -u 54322 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,asmoper,asmadmin,racdba gridecho "oracle" | passwd --stdin oracleecho "grid" | passwd --stdin grid
3.创建目录
mkdir -p /u01/app/19.3.0/gridmkdir -p /u01/app/gridmkdir -p /u01/app/oracle/product/19.3.0/db_1chown -R grid:oinstall /u01chown -R oracle:oinstall /u01/app/oraclechmod -R 775 /u01/
4.关闭防火墙和selinux
systemctl stop firewalld.servicesystemctl disable firewalld.servicesed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config #关闭selinux
5.关闭时钟同步
systemctl stop chronydsystemctl disable chronyd移除chrony配置文件:(必须移除,否则校验NTP失败)mv /etc/chrony.conf /etc/chrony.conf.bak
6.关闭avahi-daemon
systemctl stop avahi-daemonsystemctl disable avahi-daemon
7.设置环境变量
vim /home/oracle/.bash_profile ORACLE_SID=cndba1;export ORACLE_SIDORACLE_UNQNAME=cndba;export ORACLE_UNQNAMEJAVA_HOME=/usr/local/java; export JAVA_HOMEORACLE_BASE=/u01/app/oracle; export ORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1; export ORACLE_HOMEORACLE_TERM=xterm; export ORACLE_TERMNLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"; export NLS_DATE_FORMATNLS_LANG=american_america.ZHS16GBK; export NLS_LANGTNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMINORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/binPATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/binexport PATHLD_LIBRARY_PATH=$ORACLE_HOME/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/libexport LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/JRECLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlibexport CLASSPATHTHREADS_FLAG=native; export THREADS_FLAGexport TEMP=/tmpexport TMPDIR=/tmpumask 022
vim /home/grid/.bash_profilePATH=$PATH:$HOME/binexport ORACLE_SID=+ASM1 export ORACLE_BASE=/u01/app/gridexport ORACLE_HOME=/u01/app/19.3.0/gridexport PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.export TEMP=/tmpexport TMP=/tmpexport TMPDIR=/tmpumask 022export PATH
8.修改资源限制
cat >> /etc/security/limits.conf <<EOFgrid soft nproc 2047grid hard nproc 16384grid soft nofile 1024grid hard nofile 65536grid soft stack 10240grid hard stack 32768oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240oracle hard stack 32768oracle soft memlock 3145728oracle hard memlock 3145728EOF
9.设置 PAM和NOZEROCONF
cat >> /etc/pam.d/login <<EOFsession required pam_limits.soEOF
echo "NOZEROCONF=yes" >>/etc/sysconfig/network
10.修改内核参数
cat >> /etc/sysctl.d/sysctl.conf <<EOF fs.file-max = 6815744kernel.sem = 250 32000 100 128kernel.shmmni = 4096kernel.shmall = 1073741824kernel.shmmax = 4398046511104kernel.panic_on_oops = 1net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576net.ipv4.conf.all.rp_filter = 2net.ipv4.conf.default.rp_filter = 2fs.aio-max-nr = 1048576net.ipv4.ip_local_port_range = 9000 65500EOFsysctl -p
11.配置yum源,下载对应的包
[root@localhost ~]# mkdir /yums[root@localhost ~]# cd /run/media/root/CentOS\ 7\ x86_64/Packages/[root@localhost Packages]# cp * /yums[root@localhost Packages]# cd /yums[root@localhost yums]# createrepo .Spawning worker 0 with 1006 pkgsSpawning worker 1 with 1005 pkgsSpawning worker 2 with 1005 pkgsSpawning worker 3 with 1005 pkgsWorkers FinishedSaving Primary metadataSaving file lists metadataSaving other metadataGenerating sqlite DBsSqlite DBs complete[root@localhost yums]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# rm -rf *[root@localhost yum.repos.d]# vim yum.local.repo[local]name=yum local repobaseurl=file:///yumsgpgcheck=0enable=1[root@localhost yum.repos.d]# yum clean allLoaded plugins: fastestmirror, langpacksCleaning repos: localCleaning up list of fastest mirrors
下载需要的包
yum install -y bc yum install -y compat-libcap1* yum install -y compat-libcap* yum install -y binutils yum install -y compat-libstdc++-33 yum install -y elfutils-libelf yum install -y elfutils-libelf-devel yum install -y gcc yum install -y gcc-c++ yum install -y glibc-2.5 yum install -y glibc-common yum install -y glibc-devel yum install -y glibc-headers yum install -y ksh libaio yum install -y libaio-devel yum install -y libgcc yum install -y libstdc++ yum install -y libstdc++-devel yum install -y make yum install -y sysstat yum install -y unixODBC yum install -y unixODBC-devel yum install -y binutils* yum install -y compat-libstdc* yum install -y elfutils-libelf* yum install -y gcc* yum install -y glibc* yum install -y ksh* yum install -y libaio* yum install -y libgcc* yum install -y libstdc* yum install -y make* yum install -y sysstat* yum install -y libXp* yum install -y glibc-kernheaders yum install -y net-tools-*
compat-libstdc+±33-3.2.3-72.el7.x86_64、oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm这个包需要单独下载
[root@localhost opt]# lltotal 131220-rw-rw-rw-. 1 root root 195388 Jun 10 11:34 compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm-rw-rw-rw-. 1 root root 113475584 Jun 10 11:34 LINUX.X64_193000_db_home.zip-rw-rw-rw-. 1 root root 18204 Jun 10 11:34 oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm.rpmdrwxr-xr-x. 2 root root 6 Oct 31 2018 rh[root@localhost opt]# rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm warning: compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:compat-libstdc++-33-3.2.3-72.el7 ################################# [100%][root@localhost opt]# rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm.rpm warning: oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEYPreparing... ################################# [100%]Updating / installing... 1:oracle-database-preinstall-19c-1.################################# [100%]
12.配置互信(rac1、rac2都配置)
root账户
ssh-copy-id rac1ssh-copy-id rac2
grid账户
ssh-copy-id rac1ssh-copy-id rac2
oracle账户
ssh-copy-id rac1ssh-copy-id rac2
13.配置共享盘
lsblk查看磁盘情况
生成asm命名的磁盘
使用udev配置Asm磁盘
vi asm.sh //编辑脚本#!/bin/bashfor i in b c d e f g ;doecho "KERNEL==\"sd*\",ENV{DEVTYPE}==\"disk\",SUBSYSTEM==\"block\",PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d \$devnode\",RESULT==\"`/usr/lib/udev/scsi_id -g -u /dev/sd$i`\", RUN+=\"/bin/sh -c 'mknod /dev/asmdisk$i b \$major \$minor; chown grid:asmadmin /dev/asmdisk$i; chmod 0660 /dev/asmdisk$i'\""donechmod +x asm.sh./asm.sh //运行脚本KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29726af9e28f0fff1eb68332efe", RUN+="/bin/sh -c 'mknod /dev/asmdiskb b $major $minor; chown grid:asmadmin /dev/asmdiskb; chmod 0660 /dev/asmdiskb'"KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29489b1433445c0e319c861b453", RUN+="/bin/sh -c 'mknod /dev/asmdiskc b $major $minor; chown grid:asmadmin /dev/asmdiskc; chmod 0660 /dev/asmdiskc'"KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29860c1a4c08b7344006cdf81bb", RUN+="/bin/sh -c 'mknod /dev/asmdiskd b $major $minor; chown grid:asmadmin /dev/asmdiskd; chmod 0660 /dev/asmdiskd'"KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c295280791ed04403e7f5fe4222a", RUN+="/bin/sh -c 'mknod /dev/asmdiske b $major $minor; chown grid:asmadmin /dev/asmdiske; chmod 0660 /dev/asmdiske'"KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29b55e4b3acd130917d38bf2154", RUN+="/bin/sh -c 'mknod /dev/asmdiskf b $major $minor; chown grid:asmadmin /dev/asmdiskf; chmod 0660 /dev/asmdiskf'"KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29fd176d048954f94dbd82bc1fd", RUN+="/bin/sh -c 'mknod /dev/asmdiskg b $major $minor; chown grid:asmadmin /dev/asmdiskg; chmod 0660 /dev/asmdiskg'"vi /etc/udev/rules.d/99-oracle-asmdevices.rules //把上面的运行脚本之后生成的内容复制到这个规则 udevadm control --reload //udevadm配置重载生效udevadm trigger ll /dev/asm* ##两个节点是一样的哦~
1.安装grid
上传安装包,修改权限
chown -R grid:oinstall LINUX.X64_193000_grid_home.zip
切换grid用户
安装cvuqdisk 两个节点都安装
节点一操作: ##root用户安装cd /u01/app/19.3.0/grid/cv/rpm rpm -ivh cvuqdisk-1.0.10-1.rpm scp -p /u01/app/19.3.0/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm rac2:/opt/ 节点二操作:cd /opt/ rpm -ivh cvuqdisk-1.0.10-1.rpm
运行安装脚本gridSetup.sh
配置集群的名称
scan name必须和 /etc/hosts里面scan的名字一样,cluster name 可以不改
添加节点2
保证心跳ip之间可以ping通
网段选择
一般的话会有一个virbr0网卡,自行百度删掉即可,或者在Use for中选择不使用选项
选择asm磁盘组
关于DNS的问题可以忽略,若是其他问题需要关注,否则后续会出现问题
当出现弹窗时,开始root用户执行脚本,先在rac1执行,然后在rac2执行,一共两个脚本,按照顺序,第二个脚本执行的比较慢,稍安勿躁
脚本执行结束之后,点击ok,安装,时间还是很漫长
有一个报错,能ping通scan ip就可以忽略
2.安装oracle
root用户修改db压缩包的属主属组
oracle用户解压压缩包
unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/db_1/
出现弹窗执行脚本,按照顺序来执行
/u01/app/oracle/product/19.3.0/db_1/root.sh
3.创建数据库实例
在oracle账户下执行dbca
注意:数据库名称可以写别的,但是SID必须写和你设置的Oracle用户环境变量里边的ORACLE_SID一致!
勾选快速回复 开启归档日志
查看集群状态
使用客户端工具测试,连接正常
参考文档:
https://blog.csdn.net/weixin_36065860/article/details/105772692
https://www.cndba.cn/dave/article/4073
https://oracle-base.com/articles/19c/oracle-db-19c-rac-installation-on-oracle-linux-7-using-virtualbox
来源地址:https://blog.csdn.net/m0_71163619/article/details/131061288