relink all With Grid Infrastructure and Oracle Homes
Linux patching (OS security updates, kernel upgrades, etc.) is a routine activity for system administrators. For Oracle RAC environments, DBAs must ensure pre-patching checks, safe shutdowns, and post-patch relinks are properly executed to avoid service disruption.
1. Why Pre-Patching Checks Are Critical
Before handing over the server to the Linux team, DBAs must:
- Capture database and listener state
- Record clusterware resources
- Collect ASM diskgroup details
- Backup OS and crontab configurations
These pre-checks serve as a baseline snapshot. After patching, DBAs can compare the current state to confirm successful recovery.
2. Pre-Patching Activities
OS-Level Checks
Run these commands as oracle/grid users to capture environment details:
# Database processes
ps -eaf | grep pmon
ps -eaf | grep tns
# Mounted filesystems
df -kh
# Oracle inventory files
cat /etc/oratab
cat /etc/hosts
# Crontab backup
crontab -l > crontab_backup.txt
# Listener status
lsnrctl status LISTENER
Database-Level Checks
Connect to each database and run:
-- Database role and mode
select name, open_mode, database_role, controlfile_type, switchover_status, db_unique_name
from gv$database order by 1;
-- SPFILE location
show parameter spfile;
-- Controlfile details
show parameter control;
-- Listener, service, cluster parameters
show parameter listener;
show parameter service;
show parameter cluster;
-- Datafile and tempfile
select name from v$datafile;
select name from v$tempfile;
-- Redo log files
select member from v$logfile;
-- Controlfile locations
select name from v$controlfile;
-- ASM Diskgroup info
select name, state, type, total_mb, free_mb from v$asm_diskgroup;
select name, path, header_status, mode_status from v$asm_disk;
Low-Level Disk Checks
# Device files
cd /dev
ls -larth
# Multipath devices
cd /dev/mapper
ls -larth
Grid Infrastructure Checks
Run as grid user:
# Grid processes
ps -eaf | grep grid
# Clusterware resource status
crsctl stat res -t
# CRS health check
crsctl check crs
# Listener status
lsnrctl status LISTENER
👉 Important: Before patching, disable CRS to prevent automatic startup during reboot.
su - root
$GRID_HOME/bin/crsctl disable crs
This ensures CRS does not start accidentally while Linux team is still patching or rebooting nodes.
3. Automated Pre-Patch Script
Here’s a ready-to-use script to gather all pre-patching data:
#!/bin/bash
# prepatch_check.sh
# Run as oracle/grid before handing server to Linux team
LOGFILE=prepatch_$(hostname)_$(date +%Y%m%d%H%M).log
echo "===== Pre-Patching Checks on $(hostname) =====" | tee -a $LOGFILE
echo "== Database Processes ==" | tee -a $LOGFILE
ps -eaf | grep pmon | tee -a $LOGFILE
ps -eaf | grep tns | tee -a $LOGFILE
echo "== Filesystems ==" | tee -a $LOGFILE
df -kh | tee -a $LOGFILE
echo "== /etc/oratab ==" | tee -a $LOGFILE
cat /etc/oratab | tee -a $LOGFILE
echo "== /etc/hosts ==" | tee -a $LOGFILE
cat /etc/hosts | tee -a $LOGFILE
echo "== Crontab ==" | tee -a $LOGFILE
crontab -l | tee crontab_backup_$(whoami).txt | tee -a $LOGFILE
echo "== Listener Status ==" | tee -a $LOGFILE
lsnrctl status LISTENER | tee -a $LOGFILE
echo "== CRS Status ==" | tee -a $LOGFILE
crsctl stat res -t | tee -a $LOGFILE
crsctl check crs | tee -a $LOGFILE
echo "== Device Mapping ==" | tee -a $LOGFILE
ls -larth /dev | tee -a $LOGFILE
ls -larth /dev/mapper | tee -a $LOGFILE
echo "Pre-patch checks completed. Logs saved at $LOGFILE"
Run:
chmod +x prepatch_check.sh
./prepatch_check.sh
4. Handover to Linux Team
At this stage:
- DBs and listeners should be stopped
- Crontabs are backed up
- CRS disabled (
crsctl disable crs
)
Now handover the server to the Linux team for patching and reboot.
5. Post-Patching Activities
After Linux patching is complete, perform the following per RAC node:
Step 1: Relink Grid Infrastructure
su - root
$GRID_HOME/crs/install/rootcrs.sh -unlock
su - grid
cd $GRID_HOME/bin
relink all
su - root
$GRID_HOME/crs/install/rootcrs.sh -lock
$GRID_HOME/bin/crsctl enable crs
$GRID_HOME/bin/crsctl start crs
Step 2: Relink Oracle Database
su - oracle
cd $ORACLE_HOME/bin
relink all
Step 3: Startup and Verification
-- Start databases
sqlplus / as sysdba
startup;
-- Verify role/mode again
select name, open_mode, database_role from gv$database;
-- Check listeners
lsnrctl status LISTENER;
Step 4: Restore Crontabs
su - oracle
crontab oracle.cron
su - grid
crontab grid.cron
6. Conclusion
By following this pre-check, handover, relink, and verification cycle, DBAs ensure:
- Safe patching coordination with Linux admins
- No surprises with missing processes or CRS failures after reboot
- Grid and Database binaries properly relinked against the new Linux libraries
- Database services fully restored with baseline checks verified
This approach minimizes risk and ensures smooth Linux patching in Oracle RAC environments.
No Comments