Hey all!

Hope you are OK!

In the most recent versions of Grid Infrastructure, Oracle has changed the default location for OCR Backup from filesystem to an ASM DiskGroup. One of the goals is to make sure that the backup will be stored in a shared location across the nodes, because if you use a local filesystem and get some disk issues, you will lose your OCR backups, which is not so cool. 🙂

But, if you want, you can keep the OCR backups on ASM DiskGroups and create copies of those OCR backups into filesystem (local or not, example: NFS).

One of the goals to keep a copy of OCR Backup in a filesystem is to ask backup team to make sure that this backup will be copied to tapes as well.

Well, what we need to do to accomplish this goal?

Create a shell script and enable it in CRON on ALL cluster nodes.

ALL nodes?

Yes, that’s right!

So the job will run in more than one node?

No!

How?

Our shell script is a little bit “smart”, the script will be executed only in the master node of the cluster. So, you can keep the CRON entry enabled in all nodes, but only one node will execute the shell script (the master node). This script also will create copy only for the most recent OCR backup.

Let’s do it:

#!/bin/bash

export GRID_HOME=/oracle/app/122/grid
export PATH=/oracle/app/122/grid/bin:$PATH
export COPY_LOCATION=/oracle/backup
export MASTER_NODE=`oclumon manage -get master | grep Master | awk '{print $3}' | cut -d "." -f1 | sed -e 's/\(.*\)/\U\1/'`
export HOST=`echo $HOSTNAME | cut -d "." -f1 |sed -e 's/\(.*\)/\U\1/'`

if [ "$HOST" == "$MASTER_NODE" ]; then
OCR_BACKUP_DATE=`ocrconfig -showbackup | awk '{print $2"_" $3}' | grep "/" | head -1 | sed -r 's/\///g' | sed -r 's/\://g'`
OCR_BACKUP=`ocrconfig -showbackup | awk '{print $4}' | grep "+" | head -1`
ocrconfig -copy $OCR_BACKUP $COPY_LOCATION/ocr_backup_$OCR_BACKUP_DATE
else
exit
fi

 

You should keep attention to change the following lines:

export GRID_HOME to the directory where you installed Grid Infrastructure.

export COPY_LOCATION to the filesystem that you want to create the copy of OCR backup.

 

Hope this helps!

 

Peace!

 

Vinicius