OCR & OLR in RAC
OCR (Oracle Cluster Registry) & OLR (Oracle Local Registry)
In this section, I am going to cover the details about OCR (Oracle Cluster Registry) and OLR (Oracle Local Registry).
Let's go into the topic!!!
OCR (Oracle Cluster Registry)
OCR will have all the cluster information. If the OCR is loss, the entire cluster will be affected.
OCR is the central repository which stores the metadata, configuration, status of the clusterware resources.OCR is used to maintain application resources and availability.It also stores configuration information for CRS daemons and clusterware managed applications.
Below are the information stored in the OCR.
Let's go into the topic!!!
OCR will have all the cluster information. If the OCR is loss, the entire cluster will be affected.
OCR is the central repository which stores the metadata, configuration, status of the clusterware resources.OCR is used to maintain application resources and availability.It also stores configuration information for CRS daemons and clusterware managed applications.
Below are the information stored in the OCR.
- Node membership information ex: which nodes are the part of the cluster
- Software active version
- Server pools
- Status/Configuration for the cluster resources such as RAC databases, listeners, instances and services
- ASM instance and disk groups
- CRS application resource profiles such as VIP addresses etc..
- Database services characteristics e.g preferred/available nodes, TAF, Load balancing, goal etc..
- Information about clusterware processes
- Information about interaction and management about third party applications controlled by clusterware
- Details about network interfaces
- Information about OCR backups
OCR will be kept in all local nodes in memory for better performance which will be maintained in local cache and when the new information added into OCR, only one CRSd process will start and take care of read and write operations from the disk. It will read/write from the disk as well as the distributed across all the nodes. All OCR clients such as srvctl and crsctl will directly communicate to the local OCR to get the details. From 11gR2, we can maintain upto 5 copies of OCR file. A small disk around 300 MB- 500 MB is a good choice.
If we modify OCR file in any node that time don't shutdown any other node. If we shutdown any other node which will lead into OCR conflict. So, we should run ocrconfig -repair into that node to repair the conflict.
Below are some of the useful commands.
ocrconfig -add +DATA --> Add OCR file to an ASM +DATA
diskgroup
ocrconfig -replace <old_loc> --> replacement <diskgroupname>
ocrconfig -delete +DATA --> Removing the OCR location
ocrconfig -repair -add <locationame or anything>
ocrconfig -showbackup manual|auto --> show the backed-up files
ocrconfig -manualbackup --> to perform the manual backup
ocrconfig -export <filename> --> export the OCR file
ocrconfig -import <filename> --> import the OCR file
ocrconfig -backuploc <locationname should be any shared OS location not in ASM>
How to restore OCR
Below are steps which will explain how to restore the OCR.
- Locate the backup using --> ocrconfig -showbackup
- Stop CRS stack on all nodes --> crsctl stop crs else force it using crsctl stop crs -force(f)
- Start CRS in all node in exclusive mode --> crsctl start crs -excl
- Stop CRSD if it is running --> crsctl stop resource ora.crsd -init
- Restore OCR --> ocrconfig -restore <filename>
- Verify OCR integrity --> ocrcheck
- Stop CRS on the node from where it is started --> crsctl stop crs
- start CRS on all nodes --> crsctl start crs
- Check the integrity of the newly restored OCR --> cluvfy comp ocr -n all -verbose
OLR (Oracle Local Registry)
This is introduced in Oracle 11gR2 which will have all the resource information about the node and it can't shared across nodes.Why Oracle introduced OLR in the sense of, while starting the clusterware some of the resources needs to be started first. Before 11gR2, everything stored in OCR which is residing in OS files. But from 11gR2, OCR and voting disk Saved in ASM. So, to start the clusterware, need to start the ASM first. Without knowing resource information Oracle can't start ASM. So for that reason, Oracle is maintaining Local registry to start the resources and start
the clusterware.
If OLR is missing/corrupted, the clusterware won't get started.
This OLR resides in $ORACLE_HOME/cdata/node1.olr and the location of OLR is stored in /etc/oracle/olr.loc
Below are the information stored in the OLR.
- The version of the clusterware
- Clusterware configuration
- The information about the resources which needs to be started on the node. Some of the other details as well
Useful commands,
ocrconfig -local --> used to take backup all those things
ocrcheck -local --> used to check the OLR configuration
ocrdump -local --> used to dump the output to any file or stdout
[grid@node1 node1]$ ocrconfig -help
Name:
ocrconfig - Configuration tool for Oracle Cluster/Local Registry.
Synopsis:
ocrconfig [option]
option:
[-local] -export <filename>
- Export OCR/OLR contents to a file
[-local] -import <filename> - Import OCR/OLR contents from a file
[-local] -upgrade [<user> [<group>]]
- Upgrade OCR from previous version
-downgrade [-version <version string>]
- Downgrade OCR to the specified version
[-local] -backuploc { <dirname> | +<diskgroupname> }
- Configure OCR/OLR backup location
[-local] -showbackuploc - Show OCR/OLR backup location
[-local] -showbackup [auto|manual] - Show OCR/OLR backup information
[-local] -manualbackup - Perform OCR/OLR backup
[-local] -restore <filename> - Restore OCR/OLR from physical backup
-replace <current filename> -replacement <new filename>
- Replace an OCR device or file <current filename> with <new filename>
-add <filename> - Add a new OCR device/file
-delete <filename> - Remove a OCR device/file
-overwrite - Overwrite OCR configuration on disk
-repair -add <filename> | -delete <filename> | -replace <current filename> -replacement <new filename>
- Repair OCR configuration on the local node
-copy <source_filename> <destination_filename>
- Copy OCR physical backup from source to destination
-help - Print out this help information
Notes:
* Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.
* For Oracle Local Registry, only '-local -showbackup [manual]' is supported.
* For Oracle Local Registry, only '-local -backuploc <dirname>' is supported.
* Administering the Oracle Cluster Registry from a Leaf node is not supported.
[grid@node1 node1]$ ocrcheck -help
Name:
ocrcheck - Displays health of Oracle Cluster/Local Registry.
Synopsis:
ocrcheck [-config] [-details] [-local]
-config Displays the configured locations of the Oracle Cluster Registry.
This can be used with the -local option to display the configured
location of the Oracle Local Registry
-details Displays detailed configuration information.
-local The operation will be performed on the Oracle Local Registry.
Notes:
* This command for Oracle Cluster Registry is not supported from a Leaf node.
[grid@node1 node1]$ ocrdump -help
Name:
ocrdump - Dump contents of Oracle Cluster/Local Registry to a file.
Synopsis:
ocrdump [-local] [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]
Description:
Default filename is OCRDUMPFILE. Examples are:
prompt> ocrdump
writes cluster registry contents to OCRDUMPFILE in the current directory
prompt> ocrdump MYFILE
writes cluster registry contents to MYFILE in the current directory
prompt> ocrdump -stdout -keyname SYSTEM
writes the subtree of SYSTEM in the cluster registry to stdout
prompt> ocrdump -local -stdout -xml
writes local registry contents to stdout in xml format
prompt> ocrdump -backupfile /oracle/CRSHOME/backup.ocr -stdout -xml
writes registry contents in the backup file to stdout in xml format
Notes:
* The header information will be retrieved based on best effort basis.
* Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.
* This command for Oracle Cluster Registry is not supported from a Leaf node when the Oracle Clusterware is not running.
Oracle will automatically backedup the OLR and maintains only
--> Last 3 4hrs backup
--> Last 2 Daily Backup
--> Last 2 Weekly Backup
This configuration we can't control it and we can change the backup location using ocrconfig command.
If we loss/deleted OLR, we need to restore using below steps
- Stop the crs using --> crsctl stop crs
- ocrconfig -local -restore filename
- If the above command is not working, we need to manually create the file in the location
- cd <OLR location>
- touch node1.olr
- chmod 600 node1.olr
- chown grid:oinstall node1.olr
- ocrcheck -local
- crsctl start crs
- cluvfy comp olr
Comments
Post a Comment