Home
 | 
Articles
 | 
High Availability
 | 
Oracle Local Registry (OLR)
 | 
Oracle Local Registry (OLR)
 
Overview
Recent Article
All Archives
Topics
Comments 
Last modified: August 2016
»»
In Oracle Clusterware 11g Release 2 and later an additional component related to the OCR called the Oracle Local Registry (OLR) is installed on each node in the cluster. The OLR is a local registry for node specific resources. The OLR is not shared by other nodes in the cluster. It is installed and configured when Oracle Clusterware is installed.
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.
Location of OLR:
The OLR file is located in the ${GI_HOME}/cdata/<hostname>.olr. The location of OLR is stored in /etc/oracle/olr.loc and used by OHASD.
$
[root@ol-alpha ~]# cat /etc/oracle/olr.loc
olrconfig_loc=/u01/app/12.1.0/grid/cdata/ol-alpha.olr
crs_home=/u01/app/12.1.0/grid
Listing Backup:
The 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.
$<>  
[root@ol-alpha ~]# ocrconfig -local -showbackup
ol-alpha     2017/01/17 21:04:59     /u01/app/12.1.0/grid/cdata/ol-alpha/backup_20170117_210459.olr     0
To manually back up OLR
$<>  
[root@ol-alpha ~]# ocrconfig -local -manualbackup
ol-alpha     2017/01/22 20:55:49     /u01/app/12.1.0/grid/cdata/ol-alpha/backup_20170122_205549.olr     0
ol-alpha     2017/01/17 21:04:59     /u01/app/12.1.0/grid/cdata/ol-alpha/backup_20170117_210459.olr     0
How to restore from backup:
I'm going to imitate as if olr is missing.
$
[root@ol-alpha cdata]# /u01/app/12.1.0/grid/cdata
[root@ol-alpha cdata]# mv ol-alpha.olr ol-alpha.rlo
Starting up OHASD should fail by now:
$<>  
[root@ol-alpha cdata]# crsctl start has
PROCL-26: Error while accessing the physical storage Operating System error [No such file or directory] [2]
CRS-4000: Command Start failed, or completed with errors.
I will try to restore from the recent backup (e.g. backup_20170122_205549.olr)
$<>  
[root@ol-alpha cdata]# ocrconfig -local -restore /u01/app/12.1.0/grid/cdata/ol-alpha/backup_20170122_205549.olr
PROTL-35: The configured OLR location is not accessible
I will place an empty file.
$
[root@ol-alpha cdata]# touch ol-alpha.olr
[root@ol-alpha cdata]# chmod 600 ol-alpha.olr
[root@ol-alpha cdata]# chown root:oinstall ol-alpha.olr
[root@ol-alpha cdata]# ls -l ol-alpha.olr
-rw-------. 1 root oinstall         0 Jan 22 20:55 ol-alpha.olr
$<>  
[root@ol-alpha cdata]# ocrconfig -local -restore /u01/app/12.1.0/grid/cdata/ol-alpha/backup_20170122_205549.olr
Backup successfully restored. Hopefully, HAS should start by now.
$
[root@ol-alpha cdata]# crsctl start has
CRS-4123: Oracle High Availability Services has been started.
Alternatively, we can use export/import the OLR file. For example,
$
[root@ol-alpha ~]# ocrconfig -local -export /tmp/exp_olr_backup_20170122_2059
[root@ol-alpha ~]# ls -l /tmp/exp_olr*
-rw-------. 1 root root 55641 Jan 22 20:59 /tmp/exp_olr_backup_20170122_2059
In order to import:
$
[root@ol-alpha ~]# cd /u01/app/12.1.0/grid/cdata/
I'm going to rename the existing OLR file as %_safe. Then would try to import from the backup (/tmp/exp_olr_backup_20170122_2059).
$
[root@ol-alpha cdata]# mv ol-alpha.olr ol-alpha.olr_safe
$
[root@ol-alpha ~]# ocrconfig -local -import /tmp/exp_olr_backup_20170122_2059
PROTL-19: Cannot proceed while the Oracle High Availability Service is running
$
[root@ol-alpha cdata]# crsctl stop crs
$<>  
[root@ol-alpha cdata]# ocrconfig -local -import /tmp/exp_olr_backup_20170122_2059
PROTL-1: Failed to initialize ocrconfig
PROCL-26: Error while accessing the physical storage Operating System error [No such file or directory] [2]
Oops! It is expecting the file there.
$
[root@ol-alpha cdata]# touch ol-alpha.olr
[root@ol-alpha cdata]# chmod 600 ol-alpha.olr
[root@ol-alpha cdata]# chown root:oinstall ol-alpha.olr
[root@ol-alpha cdata]# ls -l ol-alpha.olr
-rw-------. 1 root oinstall         0 Jan 22 21:04 ol-alpha.olr
Will retry the import once again.
$
[root@ol-alpha cdata]# ocrconfig -local -import /tmp/exp_olr_backup_20170122_2059
$
[root@ol-alpha cdata]# ls -l ol-alpha.olr
-rw-------. 1 root oinstall 503484416 Jan 22 21:05 ol-alpha.olr
$
[root@ol-alpha cdata]# crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
Please write your comment if this article was useful.

Shannura

/
You might want to read this:
How to recover OCR from loss and recreate Votedisk?