Oracle 10g RAC 搭建部署

测试环境介绍

Oracle 10g RAC 搭建部署_第1张图片

节点名称 IP地址(公网) IP地址(私网)
orclrac1 192.168.32.141 192.168.49.182
orclrac2 192.168.32.142 192.168.49.183

搭建部署规划

部署前准备

关闭防火墙,虚拟化设置,NTP同步,方法略

建立用户和组(RAC双节点)

[root@orclrac1 ~]# groupadd -g 1001 dba
[root@orclrac1 ~]# groupadd -g 1002 oinstall
[root@orclrac1 ~]# useradd -u 1001 -g oinstall -G dba oracle
[root@orclrac1 ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@orclrac1 ~]# id oracle
uid=1001(oracle) gid=1002(oinstall) groups=1002(oinstall),1001(dba)
[root@orclrac1 ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)

修改/etc/hosts文件(RAC双节点)

[root@orclrac1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

# rac-public-ip
192.168.32.141 orclrac1
192.168.32.142 orclrac2

# rac-vip
192.168.32.21 orclrac1-vip
192.168.32.22 orclrac2-vip

# rac-private-ip
192.168.49.182 orclrac1-priv
192.168.49.183 orclrac2-priv

配置用户等效性,免密访问(RAC双节点)

orclrac1

[root@orclrac1 ~]# su - oracle
[oracle@orclrac1 ~]$ mkdir .ssh
[oracle@orclrac1 ~]$ chmod 700 .ssh
[oracle@orclrac1 ~]$ cd .ssh/
[oracle@orclrac1 .ssh]$ ssh-keygen -t rsa

orclrac2

[root@orclrac2 ~]# su - oracle
[oracle@orclrac2 ~]$ mkdir .ssh
[oracle@orclrac2 ~]$ chmod 700 .ssh
[oracle@orclrac2 ~]$ cd .ssh/
[oracle@orclrac2 .ssh]$ ssh-keygen -t rsa

建立authorized_keys并修改权限

[oracle@orclrac1 .ssh]$ ls
id_rsa id_rsa.pub
[oracle@orclrac1 .ssh]$ ssh orclrac1 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@orclrac1 .ssh]$ ssh orclrac2 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@orclrac1 .ssh]$ scp authorized_keys orclrac2:/home/oracle/.ssh/
[oracle@orclrac1 .ssh]$ chmod 600 authorized_keys
[oracle@orclrac2 .ssh]$ chmod 600 authorized_keys

验证

[oracle@orclrac1 .ssh]$ ssh orclrac1 date
Fri Jul 23 21:25:07 PDT 2021
[oracle@orclrac1 .ssh]$ ssh orclrac2 date
Fri Jul 23 21:25:12 PDT 2021

[oracle@orclrac2 .ssh]$ ssh orclrac1 date
The authenticity of host 'orclrac1 (192.168.32.141)' can't be established.
ECDSA key fingerprint is SHA256:5K5+icEUX2I3C6JQ8jTgHmQRWCSnLd1VosISh0nqSWw.
ECDSA key fingerprint is MD5:29:af:9c:d1:6b:79:e9:d4:1d:71:80:52:f3:a7:4f:e5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'orclrac1,192.168.32.141' (ECDSA) to the list of known hosts.
Fri Jul 23 22:10:37 PDT 2021
[oracle@orclrac2 .ssh]$ ssh orclrac2 date
The authenticity of host 'orclrac2 (192.168.32.142)' can't be established.
ECDSA key fingerprint is SHA256:5K5+icEUX2I3C6JQ8jTgHmQRWCSnLd1VosISh0nqSWw.
ECDSA key fingerprint is MD5:29:af:9c:d1:6b:79:e9:d4:1d:71:80:52:f3:a7:4f:e5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'orclrac2,192.168.32.142' (ECDSA) to the list of known hosts.
Fri Jul 23 22:10:41 PDT 2021

软件包准备(RAC双节点)

[root@orclrac1 ~]# rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel make sysstat libaio
[root@orclrac1 ~]# yum -y install compat-db gcc-c++ libstdc++-devel
[root@orclrac1 ~]# mkdir soft
[root@orclrac1 ~]# cd soft/
[root@orclrac1 soft]# rz

[root@orclrac1 soft]# ls
pdksh-5.2.14-37.el5_8.1.x86_64.rpm
[root@orclrac1 soft]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
warning: pdksh-5.2.14-37.el5_8.1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:pdksh-5.2.14-37.el5_8.1 ################################# [100%]
[root@orclrac1 soft]# scp pdksh-5.2.14-37.el5_8.1.x86_64.rpm orclrac2:/

[root@orclrac2 ~]# cd /
[root@orclrac2 /]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
warning: pdksh-5.2.14-37.el5_8.1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:pdksh-5.2.14-37.el5_8.1 ################################# [100%]

修改系统参数(RAC双节点)

[root@orclrac1 soft]# vim /etc/sysctl.conf
[root@orclrac1 soft]# /sbin/sysctl -p
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

[root@orclrac1 soft]# vim /etc/security/limits.conf
# 添加如下
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

[root@orclrac1 soft]# vim /etc/pam.d/login
# 添加如下
session required /lib/security/pam_limits.so

[root@orclrac1 soft]# vim /etc/profile
# 添加如下
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384
ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi
fi

[root@orclrac1 soft]# vim /etc/csh.login
# 添加如下
if ( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
endif

修改系统用户的环境变量(RAC双节点)

[root@orclrac1 ~]# su - oracle
Last login: Fri Jul 23 21:18:25 PDT 2021 on pts/1
[oracle@orclrac1 ~]$ vim .bash_profile
umask=022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs
export ORACLE_SID=orclrac1
export PATH=$ORACLE_HOME/bin:$PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export TEMP=/tmp
export TMPDIR=/tmp
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
[oracle@orclrac1 ~]$ source .bash_profile

共享存储

orclrac1作为共享存储服务端

Oracle 10g RAC 搭建部署_第2张图片
新增4块盘作为集群存储使用,其中8GB作为OCR,4GB作为voting,两个10GB作为ASM磁盘组使用
[root@orclrac1 ~]# fdisk -l

Disk /dev/sdd: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d909d

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 616447 307200 83 Linux
/dev/sda2 616448 4810751 2097152 82 Linux swap / Solaris
/dev/sda3 4810752 41943039 18566144 83 Linux

Disk /dev/sdb: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sde: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
共享存储配置操作略

挂载共享磁盘(orclrac1)

每个物理磁盘一个主分区,无文件系统。
fdisk /dev/sdb
fdisk /dev/sdc
fdisk /dev/sdd
fdisk /dev/sde
[root@orclrac1 ~]# cd /etc/udev/rules.d/
[root@orclrac1 rules.d]# vim 99-ASM.rules
ACTION=="add", KERNEL=="sdb1", ENV{MAJOR}=="8", ENV{MINOR}=="17", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc1", ENV{MAJOR}=="8", ENV{MINOR}=="33", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1", ENV{MAJOR}=="8", ENV{MINOR}=="49", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde1", ENV{MAJOR}=="8", ENV{MINOR}=="65", RUN+="/bin/raw /dev/raw/raw4 %N"
KERNEL=="raw[1-4]*", OWNER="oracle", GROUP="oinstall", MODE="660"
[root@orclrac1 rules.d]# systemctl restart systemd-udev-trigger.service
[root@orclrac1 rules.d]# ll /dev/raw/raw*
crw-rw---- 1 oracle oinstall 162, 1 Jul 23 23:30 /dev/raw/raw1
crw-rw---- 1 oracle oinstall 162, 2 Jul 23 23:30 /dev/raw/raw2
crw-rw---- 1 oracle oinstall 162, 3 Jul 23 23:30 /dev/raw/raw3
crw-rw---- 1 oracle oinstall 162, 4 Jul 23 23:30 /dev/raw/raw4
crw-rw---- 1 root disk 162, 0 Jul 23 23:30 /dev/raw/rawctl
[root@orclrac1 rules.d]# scp 99-ASM.rules orclrac2:/etc/udev/rules.d/

[root@orclrac2 ~]# systemctl restart systemd-udev-trigger.service
[root@orclrac2 rules.d]# ll /dev/raw/raw*
crw-rw---- 1 oracle oinstall 162, 1 Jul 23 23:41 /dev/raw/raw1
crw-rw---- 1 oracle oinstall 162, 2 Jul 23 23:41 /dev/raw/raw2
crw-rw---- 1 oracle oinstall 162, 3 Jul 23 23:41 /dev/raw/raw3
crw-rw---- 1 oracle oinstall 162, 4 Jul 23 23:41 /dev/raw/raw4
crw-rw---- 1 root disk 162, 0 Jul 23 23:41 /dev/raw/rawctl

创建ASM磁盘组(RAC双节点)

安装ASM包

YUM安装
kernel.x86_64 0:3.10.0-1160.36.2.el7
kmod-oracleasm.x86_64 0:2.0.8-28.el7

RPM包上传安装
[root@orclrac1 rules.d]# cd /root/soft/
[root@orclrac1 soft]# rz

[root@orclrac1 soft]# ll
total 316
-rw-r--r-- 1 root root 19360 Jun 29 03:19 oracleasmlib-2.0.12-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 86908 Jun 29 03:19 oracleasm-support-2.1.11-2.el7.x86_64.rpm
[root@orclrac1 soft]# rpm -ivh oracleasm-support-2.1.11-2.el7.x86_64.rpm
[root@orclrac1 soft]# rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm
[root@orclrac1 soft]# scp oracleasm* orclrac2:/

ASM配置

[root@orclrac1 soft]# oracleasm configure -i
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
[root@orclrac1 soft]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@orclrac1 soft]# oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

ASM配置磁盘(orclrac1)

[root@orclrac1 soft]# oracleasm createdisk OCR_VOL /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@orclrac1 soft]# oracleasm listdisks
OCR_VOL
[root@orclrac1 soft]# oracleasm createdisk VOT_VOL /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@orclrac1 soft]# oracleasm createdisk ASM_DISKGROUP1 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@orclrac1 soft]# oracleasm createdisk ASM_DISKGROUP2 /dev/sde1
Writing disk header: done
Instantiating disk: done
[root@orclrac1 soft]# oracleasm listdisks
ASM_DISKGROUP1
ASM_DISKGROUP2
OCR_VOL
VOT_VOL

创建安装目录并重启服务器(RAC双节点)

[root@orclrac1 soft]# mkdir -p /u01/app/oracle
[root@orclrac1 soft]# chown oracle:oinstall /u01 -R
[root@orclrac1 soft]# reboot

开始安装

[root@orclrac1 soft]# gunzip 10201_clusterware_linux_x86_64.cpio.gz
[root@orclrac1 soft]# gunzip 10201_database_linux_x86_64.cpio.gz
[root@orclrac1 soft]# cpio -idmv < 10201_clusterware_linux_x86_64.cpio
[root@orclrac1 soft]# cd clusterware/
[root@orclrac1 clusterware]# ls
cluvfy doc install response rootpre rpm runInstaller stage upgrade welcome.html
[root@orclrac1 soft]# chown -R oracle:oinstall clusterware
[root@orclrac1 ~]# mv soft/clusterware /home/oracle/
[oracle@orclrac1 ~]$ cd clusterware/
[oracle@orclrac1 clusterware]$ ./runInstaller
Oracle 10g RAC 搭建部署_第3张图片

Oracle 10g RAC 搭建部署_第4张图片

Oracle 10g RAC 搭建部署_第5张图片

Oracle 10g RAC 搭建部署_第6张图片

Oracle 10g RAC 搭建部署_第7张图片

Oracle 10g RAC 搭建部署_第8张图片

!Oracle 10g RAC 搭建部署_第9张图片

太狠了,直接静默了
Oracle 10g RAC 搭建部署_第10张图片

image.png

Oracle 10g RAC 搭建部署_第11张图片

image.png

[root@orclrac1 soft]# /u01/app/oracle/oraInventory/orainstRoot.sh
[root@orclrac1 soft]# /u01/app/oracle/product/10.2.0/crs/root.sh
也走不通了

image.png

你可能感兴趣的:(数据库)