searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

在天翼云上部署 Oracle 19C RAC 指导笔记

2024-06-07 03:15:10
95
0

1 资源规划

0.png

1.1 系统规划

序号 节点主机名称 操作系统 虚机规格
1 p19c01 CentOS 7.9 64位 s7.2xlarge.2
2 p19c02 CentOS 7.9 64位 s7.2xlarge.2

1.2 网络规划

序号 节点主机名称 Private IP Public IP Virtual IP Scan IP
1 p19c01 192.168.100.101 192.168.10.101 192.168.10.103 192.168.10.105 192.168.10.106 192.168.10.107
2 p19c02 192.168.100.102 192.168.10.102 192.168.10.104 192.168.10.105 192.168.10.106 192.168.10.107

1.3 存储规划

序号 角色 冗余模式 大小
1 裁决盘 OCR EXTERNAL 100 G
2 数据盘 DATA EXTERNAL 200 G

2 资源创建

2.1 创建 VPC 网络

如下图所示为创建的 VPC 网络并创建了 2 个子网:
1.png

2.2 创建云主机

如下图所示为创建的云主机,共创建两台同规格的云主机:
2.png

2.3 创建共享盘

创建 2 个共享盘云硬盘并挂载至 2 个云主机上:
3.png

2.4 创建组播

创建一个组播,所属 VPC 选择上述步骤创建的 VPC,并设置为静态加入方式,配置组播组地址:

4.png

3 节点配置

3.1 hosts 文件配置

两个节点都需执行!!!

设置两个节点的主机名:

hostnamectl set-hostname p19c01
hostnamectl set-hostname p19c02

配置两个节点的/etc/hosts/文件:

192.168.10.101 p19c01
192.168.10.102 p19c02
​
192.168.100.101 p19c01-priv
192.168.100.102 p19c02-priv
​
192.168.10.103 p19c01-vip
192.168.10.104 p19c02-vip
​
192.168.10.105 p19c-scan
192.168.10.106 p19c-scan
192.168.10.107 p19c-scan

3.2 存储配置

3.2.1 SCSI 磁盘模式场景

两个节点都需执行!!!

配置udev规则,步骤如下所示:

[root@p19c01 soft]# cat asm.sh 
#!/bin/bash
for i in a b ;
do
echo "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'\""
done
[root@p19c01 soft]# cat  /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=="360000000000000000e000000002f0001", RUN+="/bin/sh -c 'mknod /dev/asmdiska b  $major $minor; chown grid:asmadmin /dev/asmdiska; chmod 0660 /dev/asmdiska'"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="360000000000000000e000000002b0001", RUN+="/bin/sh -c 'mknod /dev/asmdiskb b  $major $minor; chown grid:asmadmin /dev/asmdiskb; chmod 0660 /dev/asmdiskb'"
[root@p19c01 soft]# udevadm control --reload
[root@p19c01 soft]# udevadm trigger
[root@p19c01 soft]# 
[root@p19c01 soft]# ls -l /dev/ |grep asm
brw-rw----  1 root root      8,   0 May 24 17:08 asmdiska
brw-rw----  1 root root      8,  16 May 24 17:08 asmdiskb
[root@p19c01 soft]#
[root@p19c02 ~]# sh asm.sh 
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="360000000000000000e000000002f0001", RUN+="/bin/sh -c 'mknod /dev/asmdiska b  $major $minor; chown grid:asmadmin /dev/asmdiska; chmod 0660 /dev/asmdiska'"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="360000000000000000e000000002b0001", RUN+="/bin/sh -c 'mknod /dev/asmdiskb b  $major $minor; chown grid:asmadmin /dev/asmdiskb; chmod 0660 /dev/asmdiskb'"
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
[root@p19c02 ~]# 
[root@p19c02 ~]# udevadm control --reload
[root@p19c02 ~]# udevadm trigger
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# ls -l /dev |grep asm
brw-rw----  1 root root      8,   0 May 24 17:09 asmdiska
brw-rw----  1 root root      8,  16 May 24 17:09 asmdiskb

3.2.2 VBD 磁盘模式场景

两个节点都需执行!!!

[root@p19c01 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  380K  0 rom  
vda    253:0    0  100G  0 disk 
└─vda1 253:1    0  100G  0 part /
vdb    253:16   0  100G  0 disk 
vdc    253:32   0  200G  0 disk 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# cat /sys/class/block/vdb/serial 
965fcbe9-4f9c-4aa0-9[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# cat /sys/class/block/vdc/serial 
9367ac9e-ccf1-4e9d-8[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# vim /etc/udev/rules.d/
75-persistent-net-generator.rules  90-configure-multi-queue.rules     99-gen-net-conf.rules              
[root@p19c01 ~]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
[root@p19c01 ~]# 
[root@p19c01 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="vd*",ATTR{serial}=="965fcbe9-4f9c-4aa0-9",SYMLINK+="asm_ocr",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="vd*",ATTR{serial}=="9367ac9e-ccf1-4e9d-8",SYMLINK+="asm_data",OWNER="grid",GROUP="asmadmin",MODE="0660"
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# udevadm control --reload
[root@p19c01 ~]# 
[root@p19c01 ~]# udevadm trigger
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# ls -l /dev/ |grep asm
lrwxrwxrwx  1 root root           3 May 27 15:30 asm_data -> vdc
lrwxrwxrwx  1 root root           3 May 27 15:30 asm_ocr -> vdb
[root@p19c02 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  380K  0 rom  
vda    253:0    0  100G  0 disk 
└─vda1 253:1    0  100G  0 part /
vdb    253:16   0  100G  0 disk 
vdc    253:32   0  200G  0 disk 
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# udevadm control --reload
[root@p19c02 ~]# 
[root@p19c02 ~]# udevadm trigger
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# ls -l /dev/ |grep asm
lrwxrwxrwx  1 root root           3 May 27 15:31 asm_data -> vdc
lrwxrwxrwx  1 root root           3 May 27 15:31 asm_ocr -> vdb
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="vd*",ATTR{serial}=="965fcbe9-4f9c-4aa0-9",SYMLINK+="asm_ocr",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="vd*",ATTR{serial}=="9367ac9e-ccf1-4e9d-8",SYMLINK+="asm_data",OWNER="grid",GROUP="asmadmin",MODE="0660"
[root@p19c02 ~]#

3.3 avahi-daemon 配置

两个节点都需执行!!!

yum install -y avahi*
systemctl disable avahi-daemon.service

3.4 系统参数配置

两个节点都需执行!!!

配置参数文件如下所示:

memTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}')
totalMemory=$((memTotal / 2048))
shmall=$((memTotal / 4))
if [ $shmall -lt 2097152 ]; then
    shmall=2097152
fi
shmmax=$((memTotal * 1024 - 1))
if [ "$shmmax" -lt 4294967295 ]; then
    shmmax=4294967295
fi
cat <<EOF>>/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = $shmall
kernel.shmmax = $shmmax
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
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.eth1.rp_filter = 2
EOF

生效系统参数:

sysctl -p

3.5 系统资源限制配置

两个节点都需执行!!!

配置limits.conf

cat <<EOF>>/etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard memlock 134217728
oracle soft memlock 134217728

grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
grid soft nproc 2047
grid hard nproc 16384
EOF

配置pam.d/login

cat <<EOF>>/etc/pam.d/login
session required pam_limits.so 
session required /lib64/security/pam_limits.so
EOF

3.6 用户及组、目录创建

两个节点都需执行!!!

用户组创建:

/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

用户grid/oracle创建:

/usr/sbin/useradd -u 11012 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba,oper grid
/usr/sbin/useradd -u 54321 -g oinstall -G asmdba,dba,backupdba,dgdba,kmdba,racdba,oper oracle
echo "oracle" |passwd oracle --stdin
echo "oracle" |passwd grid --stdin
id grid
id oracle
udevadm control --reload-rules
udevadm trigger
ll /dev |grep asm

创建软件目录:

mkdir -p /u01/app/19.3.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle/product/19.3.0/db
mkdir -p /u01/app/oraInventory
mkdir -p /backup
mkdir -p /home/oracle/scripts
chown -R oracle:oinstall /backup
chown -R oracle:oinstall /home/oracle/scripts
chown -R grid:oinstall /u01
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/19.3.0/grid
chown -R grid:oinstall /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

3.7 环境变量配置

两个节点都需执行!!!

用户grid环境变量:

cat <<EOF>>/home/grid/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM1
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysasm'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' 
EOF
cat <<EOF>>/home/grid/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM2
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysasm'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' 
EOF

用户oracle环境变量:

cat <<EOF>>/home/oracle/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.3.0/db
export ORACLE_HOSTNAME=p19c01
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=p19c01
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysdba'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ '
################OracleEnd#########################
EOF
cat <<EOF>>/home/oracle/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.3.0/db
export ORACLE_HOSTNAME=p19c02
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=p19c02
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysdba'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ '
################OracleEnd#########################
EOF

3.8 SWAP 配置

两个节点都需执行!!!

dd if=/dev/zero of=/swap bs=1M count=16390
mkswap /swap
swapon /swap
echo "/swap swap swap default 0 0" >> /etc/fstab

3.9 安装依赖包

两个节点都需执行!!!

yum groupinstall -y "Server with GUI"

yum install -y bc \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
gcc \
gcc-c++ \
elfutils-libelf \
elfutils-libelf-devel \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
libX11 \
libXau \
libXi \
libXtst \
libXrender \
libXrender-devel \
make \
net-tools \
nfs-utils \
smartmontools \
sysstat \
e2fsprogs \
e2fsprogs-libs \
fontconfig-devel \
expect \
unzip \
openssh-clients \
readline* \
tigervnc* \
psmisc

3.10 上传并解压安装包

只在第一个节点执行!!!

mkdir /soft

上传安装包到该目录下:

[root@p19c01 soft]# ls -lh
total 5.6G
-rw-r--r-- 1 root root 2.9G May 21 10:44 LINUX.X64_193000_db_home.zip
-rw-r--r-- 1 root root 2.7G May 21 09:56 LINUX.X64_193000_grid_home.zip

解压grid安装包:

[root@p19c01 ~]# cd /soft 
[root@p19c01 soft]# ls -l
total 5809468
-rw-r--r-- 1 root root 3059705302 May 21 10:44 LINUX.X64_193000_db_home.zip
-rw-r--r-- 1 root root 2889184573 May 21 09:56 LINUX.X64_193000_grid_home.zip
[root@p19c01 soft]# 
[root@p19c01 soft]# chown -R grid:oinstall /soft
[root@p19c01 soft]# 
[root@p19c01 soft]# su - grid -c "unzip -q /soft/LINUX.X64_193000_grid_home.zip -d /u01/app/19.3.0/grid/"

解压oracle安装包:

[root@p19c01 soft]# ls -lh
total 5.6G
-rw-r--r-- 1 grid oinstall 2.9G May 21 10:44 LINUX.X64_193000_db_home.zip
-rw-r--r-- 1 grid oinstall 2.7G May 21 09:56 LINUX.X64_193000_grid_home.zip
[root@p19c01 soft]# 
[root@p19c01 soft]# chown -R oracle:oinstall /soft
[root@p19c01 soft]# 
[root@p19c01 soft]# su - oracle -c "unzip -q /soft/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/db/"

安装cvuqdisk

两个节点都需执行!!!

[root@p19c01 soft]# cd /u01/app/19.3.0/grid/cv/rpm/
[root@p19c01 rpm]# ls -l
total 12
-rw-r--r-- 1 grid oinstall 11412 Mar 13  2019 cvuqdisk-1.0.10-1.rpm
[root@p19c01 rpm]# rpm -ivh cvuqdisk-1.0.10-1.rpm 
Preparing...                          ################################# [100%]
Using default group oinstall to install package
Updating / installing...
   1:cvuqdisk-1.0.10-1                ################################# [100%]
[root@p19c01 rpm]# scp cvuqdisk-1.0.10-1.rpm root@p19c02:/root  
[root@p19c01 rpm]# 
[root@p19c01 rpm]# ssh p19c02
root@p19c02's password: 
Last failed login: Thu May 23 14:22:55 CST 2024 from 183.81.169.238 on ssh:notty
There were 22 failed login attempts since the last successful login.
Last login: Thu May 23 09:12:17 2024 from 101.227.46.166
[root@p19c02 ~]# ls -lh
total 12K
-rw-r--r-- 1 root root 12K May 23 15:05 cvuqdisk-1.0.10-1.rpm
[root@p19c02 ~]# rpm -ivh cvuqdisk-1.0.10-1.rpm 
Preparing...                          ################################# [100%]
Using default group oinstall to install package
Updating / installing...
   1:cvuqdisk-1.0.10-1                ################################# [100%]

4 安装 Grid 软件

配置grid用户vnc图形界面:

[root@p19c01 ~]# chown -R grid:oinstall /soft
[root@p19c01 ~]# 
[root@p19c01 ~]# su - grid
Last login: Thu May 23 14:05:58 CST 2024 on pts/0
[grid@p19c01:/home/grid]$ 
[grid@p19c01:/home/grid]$ vncserver

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth:  file /home/grid/.Xauthority does not exist

New 'p19c01:1 (grid)' desktop is p19c01:1

Creating default startup script /home/grid/.vnc/xstartup
Creating default config /home/grid/.vnc/config
Starting applications specified in /home/grid/.vnc/xstartup
Log file is /home/grid/.vnc/p19c01:1.log

[grid@p19c01:/home/grid]$ 
[grid@p19c01:/home/grid]$ 
[grid@p19c01:/home/grid]$ ps aux |grep vnc
grid      1090  1.4  0.2 286708 46392 pts/0    Sl   15:39   0:00 /bin/Xvnc :1 -auth /home/grid/.Xauthority -desktop p19c01:1 (grid) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -httpd /usr/share/vnc/classes -pn -rfbauth /home/grid/.vnc/passwd -rfbport 5901 -rfbwait 30000
grid      1103  0.0  0.0 113288  1200 pts/0    S    15:39   0:00 /bin/sh /home/grid/.vnc/xstartup
grid      1898  0.0  0.0 112820   980 pts/0    S+   15:39   0:00 grep --color=auto vnc
[grid@p19c01:/home/grid]$

vnc客户端通过VNC Viewer来访问,输入地址为节点的弹性EIP加上一个端口1
5.png

如下图所示,开始执行安装:
6.png

选择集群安装:
7.png

选择Standalone模式:
7.png

修改scan名称,与hosts文件配置scan名称保持一致:
8.png

添加节点2信息,进行互信:
9.png

输入grid用户密码,创建用户时两节点必须保持一致。

先执行Setup,再执行Test
10.png

在网卡接口用途确认界面,修改私网网络用途为ASM&Private
11.png

选择存储类型:
12.png

步骤GRIM采用默认不安装的选择:
13.png

安装填写OCR盘,一块盘冗余External,目录选择udev绑定的路径:
14.png

填写ASM密码:
15.png

默认:
16.png

默认:
17.png

默认:
18.png

默认:
19.png

默认:
20.png

默认:
21.png

安装预检查结果:
22.png

选择忽略按钮Ignore All,开始进行安装:
23.png

在两个节点上按顺序分别执行上述脚本:
24.png

两个节点都执行完成后,点击OK,继续安装。
25.png

安装完成:
26.png

这个时候查看服务状态发现只有一个节点是在线的:

[grid@p19c01:/home/grid]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.chad
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.net1.network
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.ons
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.OCR.dg(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        OFFLINE OFFLINE                               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   Started,STABLE
      2        ONLINE  OFFLINE                               Instance Shutdown,ST
                                                             ABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c01.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c02.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.qosmserver
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
--------------------------------------------------------------------------------

这是因为 2 个云主机节点的 169.254 网段不通,即 Oracle RAC 的 HAIP 不通。这里采用将 HAIP 禁用掉的方案来解决,分别在两个节点执行如下操作:

/u01/app/19.3.0/grid/bin/crsctl stop crs

/u01/app/19.3.0/grid/bin/crsctl start crs -excl -nocrs

/u01/app/19.3.0/grid/bin/crsctl modify res ora.cluster_interconnect.haip -attr "ENABLED=0" -init

/u01/app/19.3.0/grid/bin/crsctl modify res ora.asm -attr "START_DEPENDENCIES='hard(ora.cssd,ora.ctssd)pullup(ora.cssd,ora.ctssd)weak(ora.drivers.acfs)',STOP_DEPENDENCIES='hard(intermediate:ora.cssd)'" -init

/u01/app/19.3.0/grid/bin/crsctl stop crs

最后再重新两个节点的 crs,然后查看集群状态就正常了:

[grid@p19c01:/home/grid]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.chad
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.net1.network
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.ons
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.OCR.dg(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   Started,STABLE
      2        ONLINE  ONLINE       p19c02                   Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c01.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c02.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.qosmserver
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
--------------------------------------------------------------------------------

添加 ASM DATA 数据盘:

执行asmca弹出磁盘组管理界面:

27.png

查看添加成功:
28.png

[grid@p19c01:/home/grid]$ asmcmd lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304    204800   204668                0          204668              0             N  DATA/
MOUNTED  EXTERN  N         512             512   4096  4194304    102400   102064                0          102064              0             Y  OCR/

5 安装 Oracle 软件

配置oracle用户vnc图形界面:
29.png

30.png

31.png

32.png

33.png

[root@p19c01 ~]# chown -R oracle:oinstall /soft
[root@p19c01 ~]# su - oracle
Last login: Mon May 27 15:54:16 CST 2024 on pts/0
[oracle@p19c01:/home/oracle]$ 
[oracle@p19c01:/home/oracle]$ vncserver

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth:  file /home/oracle/.Xauthority does not exist

New 'p19c01:2 (oracle)' desktop is p19c01:2

Creating default startup script /home/oracle/.vnc/xstartup
Creating default config /home/oracle/.vnc/config
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/p19c01:2.log

[oracle@p19c01:/home/oracle]$ 
[oracle@p19c01:/home/oracle]$ ps aux |grep vnc
oracle    1495  1.8  0.2 286620 46376 pts/0    Sl   17:33   0:00 /bin/Xvnc :2 -auth /home/oracle/.Xauthority -desktop p19c01:2 (oracle) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -httpd /usr/share/vnc/classes -pn -rfbauth /home/oracle/.vnc/passwd -rfbport 5902 -rfbwait 30000
oracle    1523  0.0  0.0 113288  1200 pts/0    S    17:33   0:00 /bin/sh /home/oracle/.vnc/xstartup
oracle    2262  0.0  0.0 112820   984 pts/0    S+   17:34   0:00 grep --color=auto vnc
grid     20009  0.0  0.3 305292 54360 pts/0    Sl   15:56   0:04 /bin/Xvnc :1 -auth /home/grid/.Xauthority -desktop p19c01:1 (grid) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -httpd /usr/share/vnc/classes -pn -rfbauth /home/grid/.vnc/passwd -rfbport 5901 -rfbwait 30000
grid     20022  0.0  0.0 113288  1200 pts/0    S    15:56   0:00 /bin/sh /home/grid/.vnc/xstartup
[oracle@p19c01:/home/oracle]$

在vnc客户端输入弹性IP加上端口2,接入图形界面。

分别在两个节点上执行配置脚本,完成数据库的安装。

6 创建数据库实例

执行dbca命令弹出创建数据库界面:
33.png

填写实例名称:
34.png

安装预检查,忽略:
35.png

36.png

37.png

38.png

完成数据库的创建:

0条评论
0 / 1000
刘****苏
6文章数
0粉丝数
刘****苏
6 文章 | 0 粉丝
原创

在天翼云上部署 Oracle 19C RAC 指导笔记

2024-06-07 03:15:10
95
0

1 资源规划

0.png

1.1 系统规划

序号 节点主机名称 操作系统 虚机规格
1 p19c01 CentOS 7.9 64位 s7.2xlarge.2
2 p19c02 CentOS 7.9 64位 s7.2xlarge.2

1.2 网络规划

序号 节点主机名称 Private IP Public IP Virtual IP Scan IP
1 p19c01 192.168.100.101 192.168.10.101 192.168.10.103 192.168.10.105 192.168.10.106 192.168.10.107
2 p19c02 192.168.100.102 192.168.10.102 192.168.10.104 192.168.10.105 192.168.10.106 192.168.10.107

1.3 存储规划

序号 角色 冗余模式 大小
1 裁决盘 OCR EXTERNAL 100 G
2 数据盘 DATA EXTERNAL 200 G

2 资源创建

2.1 创建 VPC 网络

如下图所示为创建的 VPC 网络并创建了 2 个子网:
1.png

2.2 创建云主机

如下图所示为创建的云主机,共创建两台同规格的云主机:
2.png

2.3 创建共享盘

创建 2 个共享盘云硬盘并挂载至 2 个云主机上:
3.png

2.4 创建组播

创建一个组播,所属 VPC 选择上述步骤创建的 VPC,并设置为静态加入方式,配置组播组地址:

4.png

3 节点配置

3.1 hosts 文件配置

两个节点都需执行!!!

设置两个节点的主机名:

hostnamectl set-hostname p19c01
hostnamectl set-hostname p19c02

配置两个节点的/etc/hosts/文件:

192.168.10.101 p19c01
192.168.10.102 p19c02
​
192.168.100.101 p19c01-priv
192.168.100.102 p19c02-priv
​
192.168.10.103 p19c01-vip
192.168.10.104 p19c02-vip
​
192.168.10.105 p19c-scan
192.168.10.106 p19c-scan
192.168.10.107 p19c-scan

3.2 存储配置

3.2.1 SCSI 磁盘模式场景

两个节点都需执行!!!

配置udev规则,步骤如下所示:

[root@p19c01 soft]# cat asm.sh 
#!/bin/bash
for i in a b ;
do
echo "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'\""
done
[root@p19c01 soft]# cat  /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=="360000000000000000e000000002f0001", RUN+="/bin/sh -c 'mknod /dev/asmdiska b  $major $minor; chown grid:asmadmin /dev/asmdiska; chmod 0660 /dev/asmdiska'"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="360000000000000000e000000002b0001", RUN+="/bin/sh -c 'mknod /dev/asmdiskb b  $major $minor; chown grid:asmadmin /dev/asmdiskb; chmod 0660 /dev/asmdiskb'"
[root@p19c01 soft]# udevadm control --reload
[root@p19c01 soft]# udevadm trigger
[root@p19c01 soft]# 
[root@p19c01 soft]# ls -l /dev/ |grep asm
brw-rw----  1 root root      8,   0 May 24 17:08 asmdiska
brw-rw----  1 root root      8,  16 May 24 17:08 asmdiskb
[root@p19c01 soft]#
[root@p19c02 ~]# sh asm.sh 
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="360000000000000000e000000002f0001", RUN+="/bin/sh -c 'mknod /dev/asmdiska b  $major $minor; chown grid:asmadmin /dev/asmdiska; chmod 0660 /dev/asmdiska'"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="360000000000000000e000000002b0001", RUN+="/bin/sh -c 'mknod /dev/asmdiskb b  $major $minor; chown grid:asmadmin /dev/asmdiskb; chmod 0660 /dev/asmdiskb'"
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
[root@p19c02 ~]# 
[root@p19c02 ~]# udevadm control --reload
[root@p19c02 ~]# udevadm trigger
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# ls -l /dev |grep asm
brw-rw----  1 root root      8,   0 May 24 17:09 asmdiska
brw-rw----  1 root root      8,  16 May 24 17:09 asmdiskb

3.2.2 VBD 磁盘模式场景

两个节点都需执行!!!

[root@p19c01 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  380K  0 rom  
vda    253:0    0  100G  0 disk 
└─vda1 253:1    0  100G  0 part /
vdb    253:16   0  100G  0 disk 
vdc    253:32   0  200G  0 disk 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# cat /sys/class/block/vdb/serial 
965fcbe9-4f9c-4aa0-9[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# cat /sys/class/block/vdc/serial 
9367ac9e-ccf1-4e9d-8[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# vim /etc/udev/rules.d/
75-persistent-net-generator.rules  90-configure-multi-queue.rules     99-gen-net-conf.rules              
[root@p19c01 ~]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
[root@p19c01 ~]# 
[root@p19c01 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="vd*",ATTR{serial}=="965fcbe9-4f9c-4aa0-9",SYMLINK+="asm_ocr",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="vd*",ATTR{serial}=="9367ac9e-ccf1-4e9d-8",SYMLINK+="asm_data",OWNER="grid",GROUP="asmadmin",MODE="0660"
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# udevadm control --reload
[root@p19c01 ~]# 
[root@p19c01 ~]# udevadm trigger
[root@p19c01 ~]# 
[root@p19c01 ~]# 
[root@p19c01 ~]# ls -l /dev/ |grep asm
lrwxrwxrwx  1 root root           3 May 27 15:30 asm_data -> vdc
lrwxrwxrwx  1 root root           3 May 27 15:30 asm_ocr -> vdb
[root@p19c02 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  380K  0 rom  
vda    253:0    0  100G  0 disk 
└─vda1 253:1    0  100G  0 part /
vdb    253:16   0  100G  0 disk 
vdc    253:32   0  200G  0 disk 
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# udevadm control --reload
[root@p19c02 ~]# 
[root@p19c02 ~]# udevadm trigger
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# ls -l /dev/ |grep asm
lrwxrwxrwx  1 root root           3 May 27 15:31 asm_data -> vdc
lrwxrwxrwx  1 root root           3 May 27 15:31 asm_ocr -> vdb
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# 
[root@p19c02 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="vd*",ATTR{serial}=="965fcbe9-4f9c-4aa0-9",SYMLINK+="asm_ocr",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="vd*",ATTR{serial}=="9367ac9e-ccf1-4e9d-8",SYMLINK+="asm_data",OWNER="grid",GROUP="asmadmin",MODE="0660"
[root@p19c02 ~]#

3.3 avahi-daemon 配置

两个节点都需执行!!!

yum install -y avahi*
systemctl disable avahi-daemon.service

3.4 系统参数配置

两个节点都需执行!!!

配置参数文件如下所示:

memTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}')
totalMemory=$((memTotal / 2048))
shmall=$((memTotal / 4))
if [ $shmall -lt 2097152 ]; then
    shmall=2097152
fi
shmmax=$((memTotal * 1024 - 1))
if [ "$shmmax" -lt 4294967295 ]; then
    shmmax=4294967295
fi
cat <<EOF>>/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = $shmall
kernel.shmmax = $shmmax
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
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.eth1.rp_filter = 2
EOF

生效系统参数:

sysctl -p

3.5 系统资源限制配置

两个节点都需执行!!!

配置limits.conf

cat <<EOF>>/etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard memlock 134217728
oracle soft memlock 134217728

grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
grid soft nproc 2047
grid hard nproc 16384
EOF

配置pam.d/login

cat <<EOF>>/etc/pam.d/login
session required pam_limits.so 
session required /lib64/security/pam_limits.so
EOF

3.6 用户及组、目录创建

两个节点都需执行!!!

用户组创建:

/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

用户grid/oracle创建:

/usr/sbin/useradd -u 11012 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba,oper grid
/usr/sbin/useradd -u 54321 -g oinstall -G asmdba,dba,backupdba,dgdba,kmdba,racdba,oper oracle
echo "oracle" |passwd oracle --stdin
echo "oracle" |passwd grid --stdin
id grid
id oracle
udevadm control --reload-rules
udevadm trigger
ll /dev |grep asm

创建软件目录:

mkdir -p /u01/app/19.3.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle/product/19.3.0/db
mkdir -p /u01/app/oraInventory
mkdir -p /backup
mkdir -p /home/oracle/scripts
chown -R oracle:oinstall /backup
chown -R oracle:oinstall /home/oracle/scripts
chown -R grid:oinstall /u01
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/19.3.0/grid
chown -R grid:oinstall /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

3.7 环境变量配置

两个节点都需执行!!!

用户grid环境变量:

cat <<EOF>>/home/grid/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM1
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysasm'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' 
EOF
cat <<EOF>>/home/grid/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM2
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysasm'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' 
EOF

用户oracle环境变量:

cat <<EOF>>/home/oracle/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.3.0/db
export ORACLE_HOSTNAME=p19c01
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=p19c01
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysdba'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ '
################OracleEnd#########################
EOF
cat <<EOF>>/home/oracle/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.3.0/db
export ORACLE_HOSTNAME=p19c02
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=p19c02
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysdba'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ '
################OracleEnd#########################
EOF

3.8 SWAP 配置

两个节点都需执行!!!

dd if=/dev/zero of=/swap bs=1M count=16390
mkswap /swap
swapon /swap
echo "/swap swap swap default 0 0" >> /etc/fstab

3.9 安装依赖包

两个节点都需执行!!!

yum groupinstall -y "Server with GUI"

yum install -y bc \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
gcc \
gcc-c++ \
elfutils-libelf \
elfutils-libelf-devel \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
libX11 \
libXau \
libXi \
libXtst \
libXrender \
libXrender-devel \
make \
net-tools \
nfs-utils \
smartmontools \
sysstat \
e2fsprogs \
e2fsprogs-libs \
fontconfig-devel \
expect \
unzip \
openssh-clients \
readline* \
tigervnc* \
psmisc

3.10 上传并解压安装包

只在第一个节点执行!!!

mkdir /soft

上传安装包到该目录下:

[root@p19c01 soft]# ls -lh
total 5.6G
-rw-r--r-- 1 root root 2.9G May 21 10:44 LINUX.X64_193000_db_home.zip
-rw-r--r-- 1 root root 2.7G May 21 09:56 LINUX.X64_193000_grid_home.zip

解压grid安装包:

[root@p19c01 ~]# cd /soft 
[root@p19c01 soft]# ls -l
total 5809468
-rw-r--r-- 1 root root 3059705302 May 21 10:44 LINUX.X64_193000_db_home.zip
-rw-r--r-- 1 root root 2889184573 May 21 09:56 LINUX.X64_193000_grid_home.zip
[root@p19c01 soft]# 
[root@p19c01 soft]# chown -R grid:oinstall /soft
[root@p19c01 soft]# 
[root@p19c01 soft]# su - grid -c "unzip -q /soft/LINUX.X64_193000_grid_home.zip -d /u01/app/19.3.0/grid/"

解压oracle安装包:

[root@p19c01 soft]# ls -lh
total 5.6G
-rw-r--r-- 1 grid oinstall 2.9G May 21 10:44 LINUX.X64_193000_db_home.zip
-rw-r--r-- 1 grid oinstall 2.7G May 21 09:56 LINUX.X64_193000_grid_home.zip
[root@p19c01 soft]# 
[root@p19c01 soft]# chown -R oracle:oinstall /soft
[root@p19c01 soft]# 
[root@p19c01 soft]# su - oracle -c "unzip -q /soft/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/db/"

安装cvuqdisk

两个节点都需执行!!!

[root@p19c01 soft]# cd /u01/app/19.3.0/grid/cv/rpm/
[root@p19c01 rpm]# ls -l
total 12
-rw-r--r-- 1 grid oinstall 11412 Mar 13  2019 cvuqdisk-1.0.10-1.rpm
[root@p19c01 rpm]# rpm -ivh cvuqdisk-1.0.10-1.rpm 
Preparing...                          ################################# [100%]
Using default group oinstall to install package
Updating / installing...
   1:cvuqdisk-1.0.10-1                ################################# [100%]
[root@p19c01 rpm]# scp cvuqdisk-1.0.10-1.rpm root@p19c02:/root  
[root@p19c01 rpm]# 
[root@p19c01 rpm]# ssh p19c02
root@p19c02's password: 
Last failed login: Thu May 23 14:22:55 CST 2024 from 183.81.169.238 on ssh:notty
There were 22 failed login attempts since the last successful login.
Last login: Thu May 23 09:12:17 2024 from 101.227.46.166
[root@p19c02 ~]# ls -lh
total 12K
-rw-r--r-- 1 root root 12K May 23 15:05 cvuqdisk-1.0.10-1.rpm
[root@p19c02 ~]# rpm -ivh cvuqdisk-1.0.10-1.rpm 
Preparing...                          ################################# [100%]
Using default group oinstall to install package
Updating / installing...
   1:cvuqdisk-1.0.10-1                ################################# [100%]

4 安装 Grid 软件

配置grid用户vnc图形界面:

[root@p19c01 ~]# chown -R grid:oinstall /soft
[root@p19c01 ~]# 
[root@p19c01 ~]# su - grid
Last login: Thu May 23 14:05:58 CST 2024 on pts/0
[grid@p19c01:/home/grid]$ 
[grid@p19c01:/home/grid]$ vncserver

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth:  file /home/grid/.Xauthority does not exist

New 'p19c01:1 (grid)' desktop is p19c01:1

Creating default startup script /home/grid/.vnc/xstartup
Creating default config /home/grid/.vnc/config
Starting applications specified in /home/grid/.vnc/xstartup
Log file is /home/grid/.vnc/p19c01:1.log

[grid@p19c01:/home/grid]$ 
[grid@p19c01:/home/grid]$ 
[grid@p19c01:/home/grid]$ ps aux |grep vnc
grid      1090  1.4  0.2 286708 46392 pts/0    Sl   15:39   0:00 /bin/Xvnc :1 -auth /home/grid/.Xauthority -desktop p19c01:1 (grid) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -httpd /usr/share/vnc/classes -pn -rfbauth /home/grid/.vnc/passwd -rfbport 5901 -rfbwait 30000
grid      1103  0.0  0.0 113288  1200 pts/0    S    15:39   0:00 /bin/sh /home/grid/.vnc/xstartup
grid      1898  0.0  0.0 112820   980 pts/0    S+   15:39   0:00 grep --color=auto vnc
[grid@p19c01:/home/grid]$

vnc客户端通过VNC Viewer来访问,输入地址为节点的弹性EIP加上一个端口1
5.png

如下图所示,开始执行安装:
6.png

选择集群安装:
7.png

选择Standalone模式:
7.png

修改scan名称,与hosts文件配置scan名称保持一致:
8.png

添加节点2信息,进行互信:
9.png

输入grid用户密码,创建用户时两节点必须保持一致。

先执行Setup,再执行Test
10.png

在网卡接口用途确认界面,修改私网网络用途为ASM&Private
11.png

选择存储类型:
12.png

步骤GRIM采用默认不安装的选择:
13.png

安装填写OCR盘,一块盘冗余External,目录选择udev绑定的路径:
14.png

填写ASM密码:
15.png

默认:
16.png

默认:
17.png

默认:
18.png

默认:
19.png

默认:
20.png

默认:
21.png

安装预检查结果:
22.png

选择忽略按钮Ignore All,开始进行安装:
23.png

在两个节点上按顺序分别执行上述脚本:
24.png

两个节点都执行完成后,点击OK,继续安装。
25.png

安装完成:
26.png

这个时候查看服务状态发现只有一个节点是在线的:

[grid@p19c01:/home/grid]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.chad
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.net1.network
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.ons
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.OCR.dg(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        OFFLINE OFFLINE                               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   Started,STABLE
      2        ONLINE  OFFLINE                               Instance Shutdown,ST
                                                             ABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c01.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c02.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.qosmserver
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
--------------------------------------------------------------------------------

这是因为 2 个云主机节点的 169.254 网段不通,即 Oracle RAC 的 HAIP 不通。这里采用将 HAIP 禁用掉的方案来解决,分别在两个节点执行如下操作:

/u01/app/19.3.0/grid/bin/crsctl stop crs

/u01/app/19.3.0/grid/bin/crsctl start crs -excl -nocrs

/u01/app/19.3.0/grid/bin/crsctl modify res ora.cluster_interconnect.haip -attr "ENABLED=0" -init

/u01/app/19.3.0/grid/bin/crsctl modify res ora.asm -attr "START_DEPENDENCIES='hard(ora.cssd,ora.ctssd)pullup(ora.cssd,ora.ctssd)weak(ora.drivers.acfs)',STOP_DEPENDENCIES='hard(intermediate:ora.cssd)'" -init

/u01/app/19.3.0/grid/bin/crsctl stop crs

最后再重新两个节点的 crs,然后查看集群状态就正常了:

[grid@p19c01:/home/grid]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.chad
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.net1.network
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
ora.ons
               ONLINE  ONLINE       p19c01                   STABLE
               ONLINE  ONLINE       p19c02                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.OCR.dg(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   Started,STABLE
      2        ONLINE  ONLINE       p19c02                   Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       p19c01                   STABLE
      2        ONLINE  ONLINE       p19c02                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c01.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.p19c02.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.qosmserver
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       p19c02                   STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       p19c01                   STABLE
--------------------------------------------------------------------------------

添加 ASM DATA 数据盘:

执行asmca弹出磁盘组管理界面:

27.png

查看添加成功:
28.png

[grid@p19c01:/home/grid]$ asmcmd lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304    204800   204668                0          204668              0             N  DATA/
MOUNTED  EXTERN  N         512             512   4096  4194304    102400   102064                0          102064              0             Y  OCR/

5 安装 Oracle 软件

配置oracle用户vnc图形界面:
29.png

30.png

31.png

32.png

33.png

[root@p19c01 ~]# chown -R oracle:oinstall /soft
[root@p19c01 ~]# su - oracle
Last login: Mon May 27 15:54:16 CST 2024 on pts/0
[oracle@p19c01:/home/oracle]$ 
[oracle@p19c01:/home/oracle]$ vncserver

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth:  file /home/oracle/.Xauthority does not exist

New 'p19c01:2 (oracle)' desktop is p19c01:2

Creating default startup script /home/oracle/.vnc/xstartup
Creating default config /home/oracle/.vnc/config
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/p19c01:2.log

[oracle@p19c01:/home/oracle]$ 
[oracle@p19c01:/home/oracle]$ ps aux |grep vnc
oracle    1495  1.8  0.2 286620 46376 pts/0    Sl   17:33   0:00 /bin/Xvnc :2 -auth /home/oracle/.Xauthority -desktop p19c01:2 (oracle) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -httpd /usr/share/vnc/classes -pn -rfbauth /home/oracle/.vnc/passwd -rfbport 5902 -rfbwait 30000
oracle    1523  0.0  0.0 113288  1200 pts/0    S    17:33   0:00 /bin/sh /home/oracle/.vnc/xstartup
oracle    2262  0.0  0.0 112820   984 pts/0    S+   17:34   0:00 grep --color=auto vnc
grid     20009  0.0  0.3 305292 54360 pts/0    Sl   15:56   0:04 /bin/Xvnc :1 -auth /home/grid/.Xauthority -desktop p19c01:1 (grid) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -httpd /usr/share/vnc/classes -pn -rfbauth /home/grid/.vnc/passwd -rfbport 5901 -rfbwait 30000
grid     20022  0.0  0.0 113288  1200 pts/0    S    15:56   0:00 /bin/sh /home/grid/.vnc/xstartup
[oracle@p19c01:/home/oracle]$

在vnc客户端输入弹性IP加上端口2,接入图形界面。

分别在两个节点上执行配置脚本,完成数据库的安装。

6 创建数据库实例

执行dbca命令弹出创建数据库界面:
33.png

填写实例名称:
34.png

安装预检查,忽略:
35.png

36.png

37.png

38.png

完成数据库的创建:

文章来自个人专栏
知识分享
6 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
1
1