Wednesday, July 20, 2016

ocrconfig Utility # Real Application Cluster

ocrconfig Utility stores in $GRID_HOME/bin location 
ocrconfig command to manager OCR. Using this utility you can import, export, add, delete, restore, overwrite, backup, repair, replace, upgrade and downgrade OCR. Oracle performs physical backup of OCR devices for every 4 hours and location “/u01/app/11.2.0.4/grid/cdata/tnc-scan/“

[oracle@tnc1 ~]$ ocrconfig -showbackup
tnc1     2016/07/18 01:20:04     /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup00.ocr
tnc1     2016/07/18 01:20:04     /u01/app/11.2.0.4/grid/cdata/tnc-scan/day.ocr
tnc1     2016/07/18 01:20:04     /u01/app/11.2.0.4/grid/cdata/tnc-scan/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available

OCR is backed up by CRSD demon daily, weekly and monthly and we can perform manual backup information executing following command 

ocrconfig -manualbackup 
[root@tnc1 oracle]# ocrconfig -manualbackup
tnc2     2016/07/20 17:06:59     /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup_20160720_170659.ocr

To check Automated backups of OCR #
[root@tnc1 tnc-scan]# ocrconfig -showbackup auto 
tnc1     2016/07/18 01:20:04     /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup00.ocr
tnc1     2016/07/18 01:20:04     /u01/app/11.2.0.4/grid/cdata/tnc-scan/day.ocr
tnc1     2016/07/18 01:20:04     /u01/app/11.2.0.4/grid/cdata/tnc-scan/week.ocr

To check Manual backups of OCR # 
Before upgrades, when ever there is change in clusterware configuration # 

[root@tnc1 tnc-scan]# ocrconfig -showbackup manual
tnc2     2016/07/20 17:06:59     /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup_20160720_170659.ocr

 OCR is corrupted # using ocrconfig, we can restore corrupted OCR # 
All nodes in cluster, will get evicted # 
procedure # 
step 1 # 
Shutdown CRS on all nodes
crsctl stop crs -f

step 2 # 
from one node, we need to start CRS in exclusive mode
# crsctl start crs -excl

step 3 #
# we have to make sure asmdiskgroup is mounted,log in as sysasm # 
SQL> select name, state from v$asm_diskgroup;

step 4 # 
#  check for ocr backups using ocrconfig, we have to restore ocr using recent backup of OCR keys 

[root@tnc2 ~]# ocrconfig -showbackup manual
tnc2     2016/07/20 17:32:05     /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup_20160720_173205.ocr
tnc2     2016/07/20 17:06:59     /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup_20160720_170659.ocr

step 5 #
Before restoring, stop crs demon other wise you will encounter with following error #
[root@tnc2 ~]# ocrconfig -restore /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup_20160720_170659.ocr
PROT-19: Cannot proceed while the Cluster Ready Service is running

[root@tnc2 ~]# crsctl stop resource ora.crsd -init
CRS-2673: Attempting to stop 'ora.crsd' on 'tnc2'
CRS-2677: Stop of 'ora.crsd' on 'tnc2' succeeded

restore the ocr using ocrconfig
[root@tnc2 ~]# ocrconfig -restore /u01/app/11.2.0.4/grid/cdata/tnc-scan/backup_20160720_170659.ocr

step 6 # stop the crs which is running in exclusive mode
# crsctl stop crs -f 

step 7 # start crs manually on all nodes of the cluster # 
#  crsctl start crs 

step 8 # perform health checks of the cluster # 
[root@tnc1 tnc-scan]# crsctl check cluster -all
**************************************************************
tnc1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
tnc2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************

we will take back of OLR :( Oracle Local Registry ) 
[root@tnc2 ~]# ocrconfig -local -manualbackup
tnc2     2016/07/20 17:47:04     /u01/app/11.2.0.4/grid/cdata/tnc2/backup_20160720_174704.olr
tnc2     2016/07/13 12:42:19     /u01/app/11.2.0.4/grid/cdata/tnc2/backup_20160713_124219.olr


--Nikhil Tatineni--
--RAC--

Querys to monitor RAC

following few  Query's will help to find out culprits-  Query to check long running transaction from last 8 hours  Col Sid Fo...