Wednesday, February 19, 2014

Administration of Votingdisk & OCR in 11G Rac


Clusterware :

Oracle Clusterware includes two major components Voting Disk & Oracle Clusterware registry
Voting Disk :
Voting disk maintains the node membership information by collecting the heartbeats of all nodes in the cluster periodically.
the voting disk must reside on shared storage for high availability and oracle clusterware enables multiple voting disks to overcome failures of voting disks.
CSSd is responsible for collecting the heartbeats and recording them in to the voting disk

What exactly Voting Disk consists of
-Node membership info
-Heartbeat info of all nodes in the cluster
-How many nodes in the cluster
-who is joining the cluster
-who is leaving the cluster

To find out the Voting Disk location
crsctl query css votedisk

To take the backup
From 11g onwards voting disk can be automatically backup along with OCR otherwise
dd if=currentloc of=backuploc

Adding, Deleting, or Migrating Voting Disks
$crsctl query css votedisk          #find out voting disk location and how many are disks are present
$crsctl replace votedisk {path_to_vote_disk}        #to replace the location ti filesystem
$crsctl replace votedisk +FRA                #to replace into ASM
$crsctl add css votedisk {path_to_vote_disk}        #To add one or more voting disks
$crsctl add css votedisk {path_to_new_votedisk_B}   #To replace voting disk A with voting disk B, you must add voting disk B, and then delete voting disk A.
$crsctl delete css votedisk {PATH|FUID}        #To remove a voting disk

Note:
If the cluster is down and cannot restart due to lost voting disks, then you must start CSS in exclusive mode by running the following command, as root:
#crsctl start crs -excl
After you start CSS in exclusive mode, you can replace the voting disk, as follows:
#crsctl replace votedisk path_to_voting_disk

Migrating voting disks to Oracle ASM
To migrate voting disks to Oracle ASM, specify the Oracle ASM disk group name in the following command:
$ crsctl replace votedisk +asm_disk_group
You can run this command on any node in the cluster.
Verifying the voting disk location
After modifying the voting disk, verify the voting disk location, as follows:
$ crsctl query css votedisk

Restoring Voting Disks
If all of the voting disks are corrupted, then you can restore them, as follows:
Run the following command as root from only one node to start the Oracle Clusterware stack in exclusive mode, which does not require voting files to be present or usable:
# crsctl start crs -excl
Run the crsctl query css votedisk command to retrieve the list of voting files currently defined, similar to the following:
$ crsctl query css votedisk
--  -----    -----------------                --------- ---------
##  STATE    File Universal Id                File Name Disk group
 1. ONLINE   7c54856e98474f61bf349401e7c9fb95 (/dev/sdb1) [DATA]

This list may be empty if all voting disks were corrupted, or may have entries that are marked as status 3 or OFF.
Depending on where you store your voting files, do one of the following:

    If the voting disks are stored in Oracle ASM, then run the following command to migrate the voting disks to the Oracle ASM disk group you specify:
    $crsctl replace votedisk +asm_disk_group
    The Oracle ASM disk group to which you migrate the voting files must exist in Oracle ASM. You can use this command whether the voting disks were stored in Oracle ASM or some other storage device.
    If you did not store voting disks in Oracle ASM, then run the following command using the File Universal Identifier (FUID) obtained in the previous step:
    $ crsctl delete css votedisk FUID
    Add a voting disk, as follows:
    $ crsctl add css votedisk path_to_voting_disk
Stop the Oracle Clusterware stack as root:
# crsctl stop crs

Note:
If the Oracle Clusterware stack is running in exclusive mode, then use the -f option to force the shutdown of the stack.

Restart the Oracle Clusterware stack in normal mode as root:
# crsctl start crs


OCR :
which maintains the cluster configuration information of all nodes in the cluster...like resources 
as well as clusterware database information.
it also maintains the information about processes that controls the Oracle Clusterware.
the OCR must reside on shared storage for accessibility to all nodes.
OCR can be replaced online.

What exactly OCR consists of
-Node Membership info
-Software active version
-the location of 11g voting disk
-server pool
-status of the cluster resources
-server,network,database,instance,listener up/down
-Configuration for the cluster resources such as RAC databases, listeners,databases,instances
-Cluster database instance to node mapping
-ASM instances & Disk Groups
-Clusterware resources like vip,services and their status info
-TAF policy,Load Balancing
-Finally About OCR backups

Who Updates OCR
-CSSd at the time of cluster setup--->to update the status of the servers
-CSS during node addition/Deletion
-CRSd about status of nodes during failures/reconfiguration
-SRVCTL,CRSCTL,OEM,NETCA,DBCA,DBUA,ASMCA


each node in the cluster maintains a copy of local OCR in memory for better performance.
and each node is required to update the OCR as required.
Oracle uses a distributed shared memory architecture at the time of cluster management to optimize queries against cluster repository.
Each node maintains a copy of the OCR in memory. Oracle Clusterware uses a background process to access the OCR cache. Only one CRSd process (designated as the master) in the cluster performs any disk read/write activity.

cat /etc/oracle/ocr.loc     #How to find OCR location

To show the backup Info of OCR
ocrconfig -showbackup auto
ocrconfig -showbackup manual

To take the backup manually
ocrconfig -manualbackup

Adding an OCR file
ocrconfig -add /backup/ocr         # In filesystem
ocrconfig -add +FRA           # In ASM

Moving the OCR to new location
ocrconfig -replace /backup/ocr -replacement +FRA

Removing an OCR
ocrconfig -delete +FRA

Repairing OCR
ocrconfig -repair -add /backup/ocr

Logical export of the OCR
ocrconfig -export /backup/ocr/ocr.bkp

To Change the backup location Of OCR
ocrconfig -backuploc /backup/ocr

Restoing OCR steps
#ocrconfig -showbackup auto    #Find out the Location
Stop crs on all nodes
#crsctl stop crs       #if this command fails use the below command
#crsctl stop crs -f   #use this if above command fails

Start CRS on one node in exclusive mode
#crsctl start crs -excl

check crsd is running...if it's running stop it
#crsctl stop resource ora.crsd -init

Restore the OCR
#ocrconfig -restore {location of the backup}

Verify the integrity of OCR
#ocrcheck

Stop the CRS that was started exclusively
#crsctl stop crs        #if this won't workout use below command
#crsctl stop crs -f        #for forcible stopping of crs

Start the CRS on all nodes one by one
#crsctl start crs

Check the integrity of newly restore OCR
#cluvfy comp ocr -n all -verbose