Sunday, August 28, 2016

ORACLE LOCAL REGISTRY (OLR) in RAC

OLR is a local registry for node specific resources. OLR is not shared by other nodes in the cluster. It is installed and configured when Oracle clusterware is installed. Introduced in Oracle Clusterware 11g Release2 an additional component related to the OCR called the Oracle Local Registry (OLR) is installed on each node in the cluster.

Purpose of OLR
It is the very first file that is accessed to startup  clusterware when OCR is stored on ASM. OCR should be accessible to find out the resources which need to be started on a node. If OCR is on ASM, it can’t be read until ASM (which itself is a resource for the node and this information is stored in OCR) is up. To resolve this problem, information about the resources which need to be started on a node is stored in an operating system  file which is called Oracle Local Registry or OLR. Since OLR is an operating system file, it can be accessed by various processes on the node for read/write irrespective of the status of the clusterware (up/down). Hence, when  a node joins the cluster,  OLR on that node is read, various resources ,including ASM  are started on the node. Once ASM is up, OCR is accessible and is used henceforth to manage all the clusterware resources.
If OLR is missing or corrupted, clusterware can’t be started on that node.


OLR Location
 The OLR file is located in the grid_home/cdata/<hostname>.olr. The location of OLR is stored in /etc/oracle/olr.loc and used by OHASD .
OLR stores data about,
ORA_CRS_HOME
localhost version
active version
GPnP details
OCR latest backup time and location
information about OCR daily, weekly backup location
node name etc.
This information stored in the OLR is needed by OHASD to start or join a cluster

OLR Administration  
You can backup OLR using the below command,
# ocrconfig -local -manualbackup
# strings /u01/oracrs/11.2.0.4/grid/cdata/ed-olraclin1/backup_20160823_012027.olr |grep -v type |grep ora!

To view the status of the OLR file on each node use,
#ocrcheck -local
ocrdump can be used to  dump the contents of the OLR to the text terminal,
#ocrdump -local -stdout
 
You can use the ocrconfig command to export and import the OLR,
#ocrconfig -local -export <export file name >
#ocrconfig -local -import <file name>
 You can repair the OLR file should it become corrupted with the ocrconfig command,
#ocrconfig -local -repair olr <file name>
 
OLR is backed up at the end of an installation or an upgrade. After that time, you can only manually back up the OLR. Automatic backups are not supported for the OLR.

To manually back up OLR:
# ocrconfig –local –manualbackup
To view the contents of the OLR backup file,
#ocrdump -local -backupfile olr_backup_file_name
To change the OLR backup location
#ocrconfig -local -backuploc new_olr_backup_path
Steps to restore OLR,
# crsctl stop crs
# ocrconfig -local -restore file_name
# ocrcheck -local
# crsctl start crs
# cluvfy comp olr


Reference: Oracle documentation for 'Managing Oracle Cluster Registry and Voting Files'
https://docs.oracle.com/database/121/CWADD/votocr.htm#CWADD70700