Setting Up Oracle 19c RAC with ASM on CentOS 7.4
Prerequisites
1. Environment Planning
Before starting the installation, define the hardware and software specifications for the Oracle Real Application Clusters (RAC) environment.
| Component | Specification |
|---|---|
| Operating System | Two CentOS 7.4 virtual machines |
| Disk Space | 50 GB per node |
| Memory | 4 GB per node |
| Network | Dual NICs recommended |
| Database Version | Oracle 19c |
| Shared Storage | ASM (Automatic Storage Management) |
Ensure each virtual machine has two network interfaces and access to shared storage disks. The shared disks must be visible to both nodes.
2. IP Address Planning
Proper IP address planning is crucial for RAC functionality. The following IP types are required:
- Public IP: Used for client connections and management. Must be routable and configured before instalation.
- VIP (Virtual IP):strong> A floating IP that migrates to a surviving node during a failover. Not pingable until the cluster is installed.
- Private IP: Used for inter-node communication. Must be on a dedicated, private network.
- SCAN (Single Client Access Name): A single name used by clients to connect to the cluster. The SCAN listener resolves this name to one of the available RAC nodes.
Configure the /etc/hosts file on both nodes with the following entries. Ensure all IPs are on the same subnet.
# On node1 and node2
# Public IP
192.168.56.101 node1
192.168.56.102 node2
# VIP
192.168.56.103 node1-vip
192.168.56.104 node2-vip
# Private IP
10.0.0.1 node1-priv
10.0.0.2 node2-priv
# SCAN IP
192.168.56.105 rac-scan
3. Shared Storage Configuration
Oracle RAC requires shared storage accessible by all nodes. This is typically configured using a SAN or shared disks in a virtual environment.
In a VMware environment, attach at least two raw disks to each virtual machine. Ensure the disks are not independent and are shared between the nodes. After attaching, configure the shared bus setting in the VM's .vmx file:
scsi0.sharedBus = "virtual"
disk.locking = "FALSE"
4. ASM Disk Planning
Plan the ASM disk groups for different database components. A common setup includes separate disk groups for the Cluster Registry (OCR) and database data.
| Disk Group | Purpose | Size |
|---|---|---|
| OCR | Stores cluster configuration information | 3 GB |
| DATA | Stores database files | 10 GB |
| ARCHIVE | Stores data base archive logs | 5 GB |
Installation Procedure
1. System Preparation
1.1 Install Dependencies
Install the necessary packages required by Oracle software using the package manager.
yum install -y binutils \
compat-libcap1 \
compat-libstdc++-33 \
gcc \
gcc-c++ \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libXi \
libXtst \
make \
sysstat \
elfutils-libelf-devel \
unixODBC-devel
1.2 Create User and Groups
Create the required operating system groups and users for the Oracle Grid Infrastructure and Database software.
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmoper
groupadd -g 506 asmdba
useradd -u 600 -g oinstall -G dba,asmdba,oper oracle
useradd -u 601 -g oinstall -G dba,oper,asmadmin,asmoper,asmdba grid
passwd oracle
passwd grid
1.3 Create Directories and Set Permissions
Create the directory structure for the Oracle software and assign appropriate ownership and permissions.
mkdir -p /opt/oracle
chown -R grid:oinstall /opt/oracle
chmod -R 775 /opt/oracle
mkdir -p /opt/oracle/oraInventory
chown -R grid:oinstall /opt/oracle/oraInventory
chmod -R 775 /opt/oracle/oraInventory
mkdir -p /opt/oracle/grid
mkdir -p /opt/oracle/database
chown -R grid:oinstall /opt/oracle/grid
chown -R oracle:oinstall /opt/oracle/database
chmod -R 775 /opt/oracle/database
chmod -R 775 /opt/oracle/grid
1.4 Configure Kernel Parameters
Modify system limits and kernel parameters to meet Oracle requirements.
Edit /etc/security/limits.conf:
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
Edit /etc/pam.d/login and add the following line:
session required pam_limits.so
Edit /etc/sysctl.conf:
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 4194304
Apply the new kernel parameters:
sysctl -p
1.5 Time Synchronization
Disable the default NTP service and configure chronyd for time synchronization, which is preferred by Oracle.
systemctl stop ntpd
systemctl disable ntpd
mv /etc/ntp.conf /etc/ntp.conf.bak
systemctl enable chronyd
systemctl start chronyd
1.6 Security Settings
Disable SELinux and the firewall to prevent installation issues.
Edit /etc/selinux/config and set:
SELINUX=disabled
Reboot the system or run the following command to apply the change immediately:
setenforce 0
Permanently disable the firewall:
systemctl disable firewalld
systemctl stop firewalld
1.7 Set Environment Variables
Configure the environment variables for the oracle and grid users.
Edit /home/grid/.bash_profile:
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=+ASM1
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/grid
export PATH=$ORACLE_HOME/bin:$PATH
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
Edit /home/oracle/.bash_profile:
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/database
export ORACLE_SID=rac1
export PATH=$ORACLE_HOME/bin:$PATH
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. Cluster Configuration
2.1 Configure SSH Trust
Establish passwordless SSH connectivity between the oracle and grid users on all nodes to allow cluster software to communicate without manual intervention.
For the oracle user:
su - oracle
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@node2
ssh-copy-id -i ~/.ssh/id_dsa.pub oracle@node2
For the grid user:
su - grid
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub grid@node2
ssh-copy-id -i ~/.ssh/id_dsa.pub grid@node2
Verify the SSH connectivity:
ssh node2 date
ssh node2-priv date
2.2 Verify Package Installation
Confirm that all required packages are installed correctly.
rpm -q binutils \
compat-libcap1 \
compat-libstdc++-33 \
gcc \
gcc-c++ \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libXi \
libXtst \
make \
sysstat \
elfutils-libelf-devel \
unixODBC-devel
2.3 Configure UDEV Rules for ASM Disks
Create UDEV rules to map raw disks to ASM-friendly device names. This ensures consistent naming across reboots.
Create a new file /etc/udev/rules.d/99-oracle-asm.rules:
# Rule for ASM disk /dev/sdb
ACTION=="add", KERNEL=="sd[b]", ATTR{size}=="*2048", RUN+="/bin/sh -c 'mknod /dev/asm-disk1 b %M %m; chown grid:asmadmin /dev/asm-disk1; chmod 660 /dev/asm-disk1'"
# Rule for ASM disk /dev/sdc
ACTION=="add", KERNEL=="sd[c]", ATTR{size}=="*2048", RUN+="/bin/sh -c 'mknod /dev/asm-disk2 b %M %m; chown grid:asmadmin /dev/asm-disk2; chmod 660 /dev/asm-disk2'"
Reload the UDEV rules and trigger device re-reading:
udevadm control --reload-rules
udevadm trigger --type=devices --action=change
2.5 Pre-Installation Checks
Use the Oracle Cluster Verification Utility (CVU) to perform a pre-installation check to identify any configuration issues.
$ORACLE_HOME/OPatch/opatch lsinventory
$ORACLE_HOME/runcluvfy.sh stage -pre crsinst -n "node1,node2" -verbose