leo-books

leo-books

Oracleブログ

Amebaでブログを始めよう!

 

 Oracle RAC を RHEL 8 に構築する

 

環境

ホストOS:Windows 10 Pro

メモリ:64 GB

仮想化ツール:Oracle VM VirtualBox 7.0.8

ISO:rhel-8.6-x86_64-dvd.iso

Oracle:V982063-01.zip

GI:V982068-01.zip

OPatch:p6880880_190000_Linux-x86-64.zip (12.2.0.1.37)

GIRU:p35037840_190000_Linux-x86-64.zip (19.19.0.0.0)

その他:compat-libcap1-1.10-7.el7.x86_64.rpm、compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

 

 

 

 

仮想マシン

1. node1

FQDN:node1.ha.jp

メモリ:10240 MB

CPU:4

ストレージ1:100 GB

ストレージ2 (DATA):50 GB (固定)

ストレージ3 (FRA):50 GB (固定)

ストレージ4 (OCR):10 GB (固定)

enp0s3:10.0.10.101 (ホストオンリーアダプター)

enp0s8:10.0.20.101 (内部ネットワーク)

 

2. node2

FQDN:node2.ha.jp

メモリ:10240 MB

CPU:4

ストレージ1:100 GB

ストレージ2 (DATA):50 GB (固定)

ストレージ3 (FRA):50 GB (固定)

ストレージ4 (OCR):10 GB (固定)

enp0s3:10.0.10.102 (ホストオンリーアダプター)

enp0s8:10.0.20.102 (内部ネットワーク)

 

SCAN IP1:10.0.10.103

SCAN IP2:10.0.10.103

SCAN IP3:10.0.10.103

 

※DNSサーバは別途構築

 

構築手順

 

OS設定

 

[root]

 

sed -i s/SELINUX=enforcing/SELINUX=disabled/ /etc/selinux/config

 

sed -i 's/quiet"/guiet ipv6.disable=1 transparent_hugepage=never"/' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

 

systemctl stop firewalld
systemctl disable firewalld

 

reboot

 

subscription-manager register

xxxxx

xxxxx

 

subscription-manager subscribe --pool=xxxxx

 

dnf makecache

 

dnf -y install bc binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libX11 libXau libXi libXtst libgcc libnsl librdmacm libstdc++ libstdc++-devel libxcb libibverbs make smartmontools sysstat gcc gcc-c++ policycoreutils-python-*

 

dnf clean all

 

dnf -y install openssh-server bind-utils

 

echo NOZEROCONF=yes >> /etc/sysconfig/network

cat /sys/kernel/mm/transparent_hugepage/enabled

 

RAC構築準備

 

[root]

 

MEMTOTAL=$(free -b | sed -n '2p' | awk '{print $2}')
SHMMAX=$(expr $MEMTOTAL / 2)
SHMMNI=4096
PAGESIZE=$(getconf PAGE_SIZE)

cat > /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = $SHMMAX
kernel.shmall = $(expr \( $SHMMAX / $PAGESIZE \) \* \( $SHMMNI / 16 \))
kernel.shmmni = $SHMMNI
kernel.sem = 250 32000 100 128
kernel.panic_on_oops = 1
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
EOF

/sbin/sysctl --system

groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
groupadd -g 54330 racdba

useradd -u 1001 -g oinstall -G asmadmin,asmdba,asmoper,racdba grid
useradd -u 1002 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,racdba oracle

passwd oracle

xxxxx

 

passwd grid

xxxxx

 

mkdir -p /u01/app/grid
mkdir -p /u01/app/19.0.0/grid
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01

 

vi /etc/security/limits.conf

grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 5274299
oracle hard memlock 5274299

 

vi /etc/pam.d/login

session    required     pam_limits.so

 

vi /home/grid/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.0.0/grid

vi /home/oracle/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

 

systemctl stop tuned.service ktune.service
systemctl stop firewalld.service
systemctl stop postfix.service
systemctl stop avahi-daemon.service
systemctl stop avahi-daemon.socket
systemctl stop atd.service
systemctl stop bluetooth.service
systemctl stop wpa_supplicant.service
systemctl stop accounts-daemon.service
systemctl stop ModemManager.service
systemctl stop debug-shell.service
systemctl stop rtkit-daemon.service
systemctl stop rpcbind.service
systemctl stop rpcbind.socket
systemctl stop rngd.service
systemctl stop upower.service
systemctl stop rhsmcertd.service
systemctl stop colord.service
systemctl stop libstoragemgmt.service
systemctl stop ksmtuned.service
systemctl stop brltty.service
systemctl stop libvirtd
systemctl disable tuned.service ktune.service
systemctl disable firewalld.service
systemctl disable postfix.service
systemctl disable avahi-daemon.socket
systemctl disable avahi-daemon.service
systemctl disable bluetooth.service
systemctl disable wpa_supplicant.service
systemctl disable accounts-daemon.service
systemctl disable atd.service cups.service
systemctl disable ModemManager.service
systemctl disable debug-shell.service
systemctl disable rpcbind.service
systemctl disable rpcbind.socket
systemctl disable rngd.service
systemctl disable upower.service
systemctl disable rhsmcertd.service
systemctl disable rtkit-daemon.service
systemctl disable mcelog.service
systemctl disable colord.service
systemctl disable libstoragemgmt.service
systemctl disable ksmtuned.service
systemctl disable brltty.service
systemctl disable libvirtd

systemctl stop chronyd
systemctl disable chronyd
systemctl status chronyd

mv /etc/chrony.conf /etc/chrony.conf.org

 

> 仮想ディスク・デバイスに単一パーティションを作成する

 

fdisk /dev/sdb

 

> 仮想ディスク・デバイスに対してアクセス権限や所有グループが適切に設定されるように、udevのルール・ファイルを新規作成する

 

vi /etc/udev/rules.d/99-oracle.rules

KERNEL=="sd[b-z]1",ACTION=="add|change",OWNER="grid",GROUP="asmadmin",MODE="0660"

/sbin/udevadm trigger --type=devices --action=add

 

shutdown -h now

 

> クローン

 

GIインストール

 

[grid]

 

unzip $ORACLE_HOME/V982068-01.zip

mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_old

mkdir -p $ORACLE_HOME/patch

unzip $ORACLE_HOME/patch/p6880880_190000_Linux-x86-64.zip

mv $ORACLE_HOME/patch/OPatch ../

unzip /var/tmp/p35037840_190000_Linux-x86-64.zip

 

※node1 and node2
ssh-keygen -t rsa

※node2
ssh-copy-id grid@node1.ha.jp
ssh grid@node1

exit

※node1
ssh-copy-id grid@node2.ha.jp

ssh grid@node2

exit

 

[root]

 

※fix the error INS-06006(node1)
cp -p /usr/bin/scp /usr/bin/scp.bkp
echo "/usr/bin/scp.bkp -T \$*" > /usr/bin/scp

 

cp -p /u01/app/19.0.0/grid/cv/rpm/* /root/cv/

 

scp /root/cv/* root@node2:/root/cv/

 

> node2にもインストール

CVUQDISK_GRP=oinstall; export CVUQDISK_GRP
rpm -ivh /root/cv/*

 

rpm -ivh /root/compat/compat-libstdc*
rpm -ivh /root/compat/compat-libcap*

 

[grid]

 

export CV_ASSUME_DISTID=OEL7.9
$ORACLE_HOME/runcluvfy.sh stage -pre crsinst -n node1,node2 -verbose

 

export LANG=C
$ORACLE_HOME/gridSetup.sh -applyPSU /var/tmp/35037840/

 

Oracleソフトウェアインストール

 

[oracle]

 

unzip $ORACLE_HOME/V982063-01.zip

mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_old

mkdir -p $ORACLE_HOME/patch

unzip $ORACLE_HOME/patch/p6880880_190000_Linux-x86-64.zip

mv $ORACLE_HOME/patch/OPatch ../

 

export LANG=C
export CV_ASSUME_DISTID=OEL7.9
$ORACLE_HOME/deinstall/sshUserSetup.sh -user oracle -hosts "node1 node2" -advanced -exverify -confirm -noPromptPassphrase

 

$ORACLE_HOME/runInstaller

 

ASMディスクグループ作成

 

[grid]

 

export LANG=C
export CV_ASSUME_DISTID=OEL7.9
$ORACLE_HOME/bin/asmca

 

データベース作成

 

[oracle]

export LANG=C
export CV_ASSUME_DISTID=OEL7.9
$ORACLE_HOME/bin/dbca

 

エラー回避

1. Error While Restoring PDB Backup Piece

 

[grid]

 

asmcmd mkdir +DATA/ORCLCDB

asmcmd mkdir +DATA/ORCLCDB/pdbseed

asmcmd mkdir +DATA/ORCLCDB/ORCLPDB

 

※高速リカバリ領域を構成しない→DB作成後に設定

 

非CDBの場合は問題なし。CDB構成では必ず発生しました。