- In this article we are going to see the Oracle Cluster Registry in RAC (OCR) concepts
- OCR manages Oracle Clusterware and Oracle RAC database configuration information
- You can store OCR and voting disks on Oracle Automatic Storage Management (Oracle ASM), or a certified cluster file system
- Oracle recommends that you use Oracle ASM to store OCR and voting disks.
- The main purpose for Oracle Cluster Registry (OCR) is to hold cluster &
database information for RAC and Cluster Ready Services (CRS)
1)cluster database instance to node mapping
2)cluster node list
3)CRS application resource profiles.
4)Local listener & scan listener
5)VIP,Scan IP & Services.
7)ASM disk groups, volumes, file systems, and instances
8)OCRs Automatic and Manual backups information
Backing Up Oracle Cluster Registry
- This section describes how to back up OCR content and use it for recovery. The first method uses automatically generated OCR copies and the second method enables you to issue a backup command manually:
- Automatic backups: Oracle Clusterware automatically creates OCR backups every four hours. At any one time, Oracle Database always retains the last three backup copies of OCR. The CRSD process that creates the backups also creates and retains an OCR backup for each full day and at the end of each week. You cannot customize the backup frequencies or the number of files that Oracle Database retains.
- Manual backups: Run the ocrconfig -manualbackup command on a node where the Oracle Clusterware stack is up and running to force Oracle Clusterware to perform a backup of OCR at any time, rather than wait for the automatic backup. You must run the command as a user with administrative privileges. The -manualbackup option is especially useful when you want to obtain a binary backup on demand, such as before you make changes to OCR. The OLR only supports manual backups.
- When the clusterware stack is down on all nodes in the cluster, the backups that are listed by the ocrconfig -showbackup command may differ from node to node.
Oracle Clusterware 11gRelease2 backs up the OCR automatically every four hours on a schedule that is dependent on when the node started, 4-hour backups (3 max) –backup00.ocr, backup01.ocr, and backup02.ocr.
Daily backups (2 max) – day.ocr and day_.ocr
Weekly backups (2 max) – week.ocr and week_.ocr
You can use the ocrconfig command to view the current OCR backups,
To see all available backups, [root@rac1 bin]# ocrconfig -showbackup To see all available automatic backups, [root@rac1 bin]# ocrconfig -showbackup auto
Note: automatic backups will not occur, when the cluster is down
Manual backup the OCR [root@rac1 bin]# ocrconfig -manualbackup <<‐‐Physical Backup of OCR Logical backup of OCR :- The above command backs up OCR under the default Backup directory. You can export the contents of the OCR using below command, [root@rac1 bin]# ocrconfig -export /tmp/ocr_exp.ocr The logical backup of OCR (taken using export option) can be imported using the below command, [root@rac1 bin]# ocrconfig -import /tmp/ocr_exp.ocr
Verifying OCR integrity of entire cluster nodes by running CVU command:
[oracle@rac1 ~]$ cluvfy comp ocr -n all Verifying OCR integrity Checking OCR integrity... Checking the absence of a non-clustered configuration... All nodes free of non-clustered, local-only configurations Checking daemon liveness... Liveness check passed for "CRS daemon" Checking OCR config file "/etc/oracle/ocr.loc"... OCR config file "/etc/oracle/ocr.loc" check successful Disk group for ocr location "+DATA" is available on all the nodes Checking OCR backup location "/u01/app/220.127.116.11/grid/cdata/racscan" OCR backup location "/u01/app/18.104.22.168/grid/cdata/racscan" check passed NOTE: This check does not verify the integrity of the OCR contents. Execute 'ocrcheck' as a privileged user to verify the contents of OCR. OCR integrity check passed Verification of OCR integrity was successful.
To find OCR file location :-
To Know the OCR Location on the cluster environment
Run as grid installation user,
When the cluster is running,
[oracle@rac1 ~]$ ocrcheck Status of Oracle Cluster Registry is as follows : Version : 4 Total space (kbytes) : 409568 Used space (kbytes) : 1560 Available space (kbytes) : 408008 ID : 150668753 Device/File Name : +DATA Device/File integrity check succeeded Device/File not configured Device/File not configured Device/File not configured Device/File not configured Cluster registry integrity check succeeded Logical corruption check bypassed due to non-privileged user
When the cluster is running or not,
[oracle@rac1 bin]$ cat /etc/oracle/ocr.loc — In Linux ocrconfig_loc=+DATA local_only=FALSE
To change OCR Default Backup Location :-
[root@rac1 bin]#./ocrconfig -backuploc /u01
Restore OCR in Grid environment :-
Step 1 :- Stop cluster on each node (as Root user).
[root@rac1 bin]# crsctl stop crs -f
Step 2 :- We are starting the cluster in the exclusive mode (as Root user)
As root start GI in exclusive mode on one node only:
In 11gR1 cluster environment, we have to use below option to start the cluster in the exclusive mode.
[root@rac1 bin]# crsctl start crs -excl
From 11gR2 cluster environment, we have to use below option to start the cluster in the exclusive mode.
[root@rac1 bin]# crsctl start crs -excl -nocrs
Note: A new option ‘-nocrs‘ has been introduced with 22.214.171.124, which prevents the start of the ora.crsd resource. It is vital that this option is specified; otherwise the failure to start the ora.crsd resource will tear down ora.cluster_interconnect.haip, which in turn will cause ASM to crash.
If you don’t have the OCR DISK GROUP, then we need to create the disk group else move to restoring OCR DISK
Step 3 :- Restoring OCR
To Check whether ocrcheck is corrupted or not
Check status of ocrcheck,
OCR CHECK Example: # ocrcheck Status of Oracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 4404 Available space (kbytes) : 257716 ID : 1306201859 Device/File Name : +DG01 Device/File integrity check succeeded Device/File not configured Device/File not configured Device/File not configured Device/File not configured Cluster registry integrity check succeeded Logical corruption check failed
1) Check whether cluster registry integrity check is successful.
2) When you run as root user, logical corruption check will be bypassed.
If you run as oracle user, you can see this line end of the “ocrcheck” output.
“Logical corruption check bypassed due to non-privileged user”
If the OCR DISK corrupted, then perform the below steps
Locate OCR LOG file location $ORACLE_HOME /log/<hostname>/client/ocrcheck_<pid>.log The below command is used to restore the OCR from the physical backup. Shutdown CRS on all nodes. Restore the latest OCR backup(root user) :- ocrconfig restore <file name> # ocrconfig -restore $ORACLE_HOME/cdata/racscan/backup00.ocr
[oracle@rac1 ~]$ ocrcheck Status of Oracle Cluster Registry is as follows : Version : 4 Total space (kbytes) : 409568 Used space (kbytes) : 1560 Available space (kbytes) : 408008 ID : 150668671 Device/File Name : +DATA Device/File integrity check succeeded Device/File not configured Device/File not configured Device/File not configured Device/File not configured Cluster registry integrity check succeeded Logical corruption check bypassed due to non-privileged user
Catch Me On:- Hariprasath Rajaram
FB Page: https://www.facebook.com/dbahariprasath/?