Wednesday, May 18, 2011

crsctl Commands


Checking CRS Status:
crsctl check crs   <<--  for the local node
crsctl check cluster  <<--  for remote nodes in the cluster
[root@node1-pub ~]#   crsctl check cluster
                                     node1-pub    ONLINE
                                     node2-pub    ONLINE
 
Viewing Cluster name:
ocrdump -stdout -keyname SYSTEM | grep -A 1 clustername | grep ORATEXT | awk '{print $3}'
OR
Oracle creates a directory with the same name as Cluster under the $ORA_CRS_HOME/cdata.

[root@node1-pub ~]#   ls /u01/app/crs/cdata


Viewing No. Of Nodes configured in Cluster:
olsnodes -n -p –I   this also displays 3 IP’s

[root@node1-pub ~] #   olsnodes -n -p -i 
node1-pub       1       node1-prv       node1-vip
node2-pub       2       node2-prv       node2-vip

Viewing Votedisk Information:         crsctl query css votedisk
Viewing OCR Disk Information:   ocrcheck

Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3848
         Available space (kbytes) :     258272
         ID                       :  744414276
         Device/File Name         : /u02/ocfs2/ocr/OCRfile_0
                                    Device/File integrity check succeeded
         Device/File Name         : /u02/ocfs2/ocr/OCRfile_1
                                    Device/File integrity check succeeded

Various Timeout Settings in Cluster:
crsctl get css disktimeout
crsctl get css misscount
crsctl get css  reboottime

Add/Remove OCR file in Cluster:
Removing OCR File:              ocrconfig -replace ocrmirror
                                                 ocrconfig -replace ocr

Adding OCR :
1)    Get the Current status of OCR:    ocrcheck
2)    As you can see, I only have one OCR file but not the second file which is OCR Mirror.
So, I can add second OCR (OCR Mirror) as below command. 

ocrconfig -replace ocrmirror <File name>

Add/Remove Votedisk file in Cluster:
Adding Votedisk:
1)     Stop CRS on all the nodes in cluster but one.

                              crsctl stop crs

2)     Get the list of Existing Vote Disks
                      crsctl query css votedisk
    3)  Backup the Vote Disk file

             dd  if=/u02/ocfs2/vote/VDFile_0  of=$ORACLE_BASE/bkp/vd/VDFile_0
    4)  Add an Extra Votedisk into the Cluster:
            crsctl add css votedisk /u02/ocfs2/vote/VDFile_3 <<-- as oracle
     5) Confirm that the file has been added successfully:

               [root@node1-pub ~] #  ls –l /u02/ocfs2/vote/VDFile_3

Removing Votedisk:         crsctl delete css votedisk /u02/ocfs2/vote/VDFile_3
Backing Up OCR

Oracle performs physical backup of OCR devices every 4 hours under the default backup direcory $ORA_CRS_HOME/cdata/<CLUSTER_NAME> 
and then it rolls that forward to Daily, weekly and monthly backup.
 
                                ocrconfig –showbackup

Manually backing up the OCR :
ocrconfig -manualbackup      --->>>Physical Backup of OCR
You can export the contents of the OCR using below command (Logical backup).
ocrconfig -export /tmp/ocr_exp.dat -s online   ----->>>Logical Backup of OCR

Restoring OCR:       ocrconfig -restore <file name>
Locate the avialable Backups:      ocrconfig –showbackup

Perform Restore from previous Backup
[root@node2-pub ~]#   ocrconfig -restore /u01/app/crs/cdata/test-crs/week.ocr
If you have logical backup of OCR (taken using export option).

ocrconfig  -import /tmp/ocr_exp.dat
Restoring Votedisks
·         Shutdown CRS on all the nodes in Cluster.
·         Locate the current location of the Votedisks
·         Restore each of the votedisks using "dd" command from the previous good backup of Votedisk taken using the same "dd" command.
·         Start CRS on all the nodes.
crsctl stop crs
crsctl query css votedisk
dd if=<backup of Votedisk> of=<Votedisk file>     à>>>do this for all the votedisks
crsctl start crs



0 comments:

Post a Comment

Auto Scroll Stop Scroll