Moneycontrol Brokerage Recos

Monday, June 6, 2016

OCRCHECK : Oracle Cluster Registry Check utility




OCRCHECK:

The OCRCHECK utility displays the version of the OCR's block format, total space available and used space, OCRID, and the OCR locations that you have configured. OCRCHECK performs a block-by-block checksum operation for all of the blocks in all of the OCRs that you have configured. It also returns an individual status for each file and a result for the overall OCR integrity check.


Note:
Oracle supports using the ocrcheck command when, at a minimum, the Oracle Cluster Ready Services stack is OFFLINE on all nodes in the cluster because the command will run even if the stack is ONLINE but it can falsely indicate that the OCR is corrupt if the check happens while an update to OCR is underway.



Syntax
ocrcheck [-local] [-config] [-details] [-help]



[root@rac2 ~]# ocrcheck -help
Name:
        ocrcheck - Displays health of Oracle Cluster/Local Registry.

Synopsis:
        ocrcheck [-config] [-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
  -local        The operation will be performed on the Oracle Local Registry.



Notes:
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrcheck_<pid>.log.
        File creation privileges in the above directory are needed
        when running this tool.




[root@rac2 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2616
         Available space (kbytes) :     259504
         ID                       :  170058601
         Device/File Name         : +VOTE_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 succeeded



Note :- When we simply run only ocrcheck command as root user without any option then it checks the integrity of Oracle Clusterware Registry and reveals the OCR version, Total Space, Used Space and Available space. It also displays the File ID and the location where OCR is located for global access as shown in preceding output.




[root@rac2 ~]# ocrcheck -config
Oracle Cluster Registry configuration is :
         Device/File Name         : +VOTE_DATA


Note :- When we run the ocrcheck command with root user with -config option then it displays the device/diskgroup where cluster OCR is located.





 [root@rac2 ~]# ocrcheck -config -local
Oracle Local Registry configuration is :
         Device/File Name         : /u01/app/11.2.0/grid/cdata/rac2.olr
[root@rac2 ~]#


Note :- When we run the ocrcheck -config along with -local option then it displays the Oracle Local Repository(OLR), the local version of OCR  located on local node as shown in the preceding example.





Note :-

A log file will be created in
        $GRID_HOME/log/<hostname>/client/ocrcheck_<pid>.log.
        File creation privileges in the above directory are needed
        when running this tool.


A log file for each ocrcheck command run will be created under $GRID_HOME/log/<hostname>/client/ocrcheck_<pid>.log. Let's take a look at this with an example as explained below.



1 - First let's check the timestamp at the RAC node were we will be running the ocrcheck command.

[root@rac2 client]# date

Mon Jun  6 10:28:03 IST 2016


2 - Now, let's run the ocrcheck command.

[root@rac2 client]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2616
         Available space (kbytes) :     259504
         ID                       :  170058601
         Device/File Name         : +VOTE_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 succeeded




3 - Now let's go to log location ($GRID_HOME/log/<hostname>/client/ocrcheck_<pid>.log) and check for the new log file is created.

[root@rac2 client]# pwd
/u01/app/11.2.0/grid/log/rac2/client


[root@rac2 client]# ls -ltr | tail
-rw-r----- 1 root    root       256 Jun  3 12:14 ocrconfig_7211.log
-rw-r----- 1 root    root       256 Jun  3 12:21 ocrconfig_7460.log
-rw-r----- 1 root    root       342 Jun  3 12:21 ocrconfig_7469.log
-rw-r--r-- 1 oragrid oinstall  1612 Jun  6 09:56 oclskd.log
-rw-r--r-- 1 oragrid oinstall 21138 Jun  6 09:56 olsnodes.log
-rw-r--r-- 1 root    root       379 Jun  6 09:58 ocrcheck_6646.log
-rw-r--r-- 1 root    root       379 Jun  6 09:58 ocrcheck_6669.log
-rw-r----- 1 root    root       255 Jun  6 09:59 ocrcheck_6684.log
-rw-r----- 1 root    root       255 Jun  6 09:59 ocrcheck_6689.log
-rw-r--r-- 1 root    root       379 Jun  6 10:28 ocrcheck_7621.log


[root@rac2 client]# date
Mon Jun  6 10:28:52 IST 2016

Note :- We can see a new log file has been created marked in red-color above.



Contents of ocrcheck_7621.log


[root@rac2 client]# cat ocrcheck_7621.log
Oracle Database 11g Clusterware Release 11.2.0.1.0 - Production Copyright 1996, 2009 Oracle. All rights reserved.
2016-06-06 10:28:36.677: [OCRCHECK][3038611136]ocrcheck starts...
2016-06-06 10:28:37.212: [OCRCHECK][3038611136]protchcheck: OCR status : total = [262120], used = [2616], avail = [259504]

2016-06-06 10:28:40.939: [OCRCHECK][3038611136]Exiting [status=success]...

No comments:

Post a Comment