Oracle Rac - Oracle Cluster RegistryG

Introduction :
  • 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)
      cluster database instance to node mapping cluster node list CRS application resource profiles. Local listener & scan listener VIP,Scan IP & Services. ASM disk groups, volumes, file systems, and instances OCRs Automatic and Manual backups information

    Backing Up Oracle Cluster Registry :
    How to backup OCR content and use it for recovery is covered in this section. The first approach makes use of automatically created OCR copies, while the second lets you manually send a backup command :

    Backups created automatically :
    Every four hours, Oracle Clusterware generates OCR backups. The last three backup copies of the OCR are always kept on file by the Oracle Database. Every full day and at the end of every week, an OCR backup is created and stored by the same CRSD procedure that makes the backups. The quantity of files that the Oracle Database keeps and the frequency of backups are not customisable.

    Manual backups :
    For compelling Oracle Clusterware to execute an OCR backup at any time instead of waiting for the automated backup, enter the ocrconfig -manualbackup command on a node where the Oracle Clusterware stack is up and running. The command needs to be executed as an administrator user. The -manualbackup option is in particularly handy if you need a binary backup immediately, such before you modify the OCR. OLR can only handle 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 automatically backs up the OCR on a schedule that varies based on when the node starts, every four hours.
        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@racgo1 bin]# ocrconfig -showbackup
        PROT-24: Auto backups for the Oracle Cluster Registry are not available
    
        racgo1     2024/04/09 12:36:33     +DATA:/racgo-cluster/OCRBACKUP/backup_20240409_123633.ocr.278.1165840595     724960844   
        To see all available automatic backups,
        [root@racgo1 bin]# ocrconfig -showbackup auto
        Note: automatic backups will not occur, when the cluster is down
    
    Manual backup the OCR :
        [root@racgo1 bin]# ocrconfig -manualbackup   <<‐‐Physical Backup of OCR  
    
        racgo1     2024/04/09 12:36:33     +DATA:/racgo-cluster/OCRBACKUP/backup_20240409_123633.ocr.278.1165840595     724960844
        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@racgo1 bin]# ./ocrconfig -export /tmp/ocr_exp.ocr
        PROT-58: successfully exported the Oracle Cluster Registry contents to file '/tmp/ocr_exp.ocr'
    
        The logical backup of OCR (taken using export option) can be imported using the below command,
    
        [root@racgo1 bin]# ocrconfig -import /tmp/ocr_exp.ocr
        Verifying OCR integrity of entire cluster nodes by running CVU command:
        [grid@racgo1 bin]$ cluvfy comp ocr -n all
    
        Verifying OCR Integrity ...PASSED
    
        Verification of OCR integrity was successful. 
    
        CVU operation performed:      OCR integrity
        Date:                         Apr 9, 2024 12:41:02 PM
        CVU home:                     /u01/app/19c/grid/
        User:                         grid
    
    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 :
        [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,
    
        To change OCR Default Backup Location  :-
    
        [root@rac1 bin]#./ocrconfig -backuploc /u01
    
    
    OLR :
    An Oracle Local Registry (OLR), which is deployed and configured when Oracle Clusterware installs OCR, is a local registry for node-specific resources on each node in a cluster in Oracle Clusterware 11g release 2 (11.2). It includes details on Oracle Clusterware manageability, such as dependencies between different services. This data is used by Oracle High Availability Services. On every cluster node, OLR is found on local storage.
    
        It's default location is in the path $GRID_HOME/cdata/host_name.olr 
    
    
    To Check OLR status on each node using following command :
    NODE 1 :
        [root@racgo1 bin]# ./ocrcheck -local
        Status of Oracle Local Registry is as follows :
            Version                  :          4
            Total space (kbytes)     :     491684
            Used space (kbytes)      :      83144
            Available space (kbytes) :     408540
            ID                       : 2069413132
            Device/File Name         : /u01/app/grid/crsdata/racgo1/olr/racgo1_19.olr
                                            Device/File integrity check succeeded
    
            Local registry integrity check succeeded
    
            Logical corruption check succeeded 
    
    
    To backup OLR manually :
        [root@racgo1 bin]# ocrconfig -local -manualbackup
    
        racgo1     2024/04/09 12:20:09     /u01/app/grid/crsdata/racgo1/olr/backup_20240409_122009.olr     724960844     
    
        racgo1     2024/04/08 17:04:07     /u01/app/grid/crsdata/racgo1/olr/backup_20240408_170407.olr     724960844
        
        TO see the contents of the backup OLR file
        
        [root@racgo1 bin]# ./ocrdump -local -backupfile olr_backup_file_name
    
    
    To change backup location :
        [root@racgo1 bin]#  ./ocrconfig -local -backuploc new_olr_backup_path
        
        To restore OLR follow the step
        
        [root@racgo1 bin]# ./crsctl stop crs
        
        [root@racgo1 bin]# ./ocrconfig -local -restore file_name
        
        [root@racgo1 bin]# ./ocrcheck -local
        
        [root@racgo1 bin]# ./crsctl start crs
        
        [grid@racgo1 bin]$ cluvfy comp olr
    
        Verifying OLR Integrity ...PASSED
    
        Verification of OLR integrity was successful. 
    
        CVU operation performed:      OLR integrity
        Date:                         Apr 9, 2024 12:32:30 PM
        CVU home:                     /u01/app/19c/grid/
        User:                         grid
    


    (Oracle Rac - Oracle Voting Disk)