To check the OCR
Location
cat /etc/oracle/ocr.loc
[root@rac1 bin]# cat /etc/oracle/ocr.loc
#Device/file
getting replaced by device
+FRA/rac-cluster/OCRFILE/registry.255.999058231
ocrconfig_loc=+DATA/rac-cluster/OCRFILE/registry.255.982502039
ocrmirrorconfig_loc=+FRA/rac-cluster/OCRFILE/registry.255.999058231
local_only=false[root@rac1 bin]#
[root@rac1 bin]# ./ocrcheck -details
Status of Oracle Cluster Registry is as follows
:
Version : 4
Total space (kbytes) : 409568
Used space (kbytes) : 2220
Available space (kbytes) :
407348
ID : 766264505
Device/File Name :
+DATA/rac-cluster/OCRFILE/registry.255.982502039
Device/File
integrity check succeeded
Device/File Name :
+FRA/rac-cluster/OCRFILE/registry.255.999058231
Device/File
integrity check succeeded
Device/File
not configured
Device/File
not configured
Device/File
not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
Get and Set OCR
Backup Location
·
GET
ocrconfig
-showbackuploc
[root@rac1 bin]# ./ocrconfig -showbackuploc
The Oracle Cluster Registry backup location is [+DATA]
[root@rac1 bin]#
· SET
ocrconfig –backuploc
<target_loc>
[root@rac1 bin]# ./ocrconfig -backuploc +FRA
[root@rac1 bin]# ./ocrconfig -showbackuploc
The Oracle Cluster Registry backup location is
[+FRA]
[root@rac1 bin]#
·
To check OCR Backups taken manually
ocrconfig
-showbackup manual
[root@rac1 bin]# ./ocrconfig -showbackup manual
rac2
2019/02/01 03:27:57
+DATA:/rac- cluster/OCRBACKUP/backup_20190201_032757.ocr.305.999055677 0
[root@rac1 bin]#
·
To check OCR Backups taken Automatically
i.
OCR is backed up automatically every four hours
and maintains 3 copies taken one at current time and one at 4hours before and
last one is at 8 hours before .
ii.
OCR backed up daily and maintains 2 days copies
(current and previous day’s).
iii.
OCR is backed up Weekly and maintains last two
weeks copies (Current week , previous week).
iv.
OCR auto backup runs from the start time of the
node or CRS (4 hours time is calculated from the start time of the node)
ocrconfig
-showbackup auto
[root@rac1 bin]# ./ocrconfig -showbackup auto
PROT-24: Auto backups for the Oracle Cluster
Registry are not available
[root@rac1 bin]#
NOTE : My current setup does not have any auto
backups.
·
Backup OLR
ocrconfig
-manualbackup
[root@rac1 bin]# ./ocrconfig -manualbackup
rac2
2019/02/01 13:33:54
+FRA:/rac-cluster/OCRBACKUP/backup_20190201_133354.ocr.328.999092035 0
rac2
2019/02/01 03:27:57
+DATA:/rac-cluster/OCRBACKUP/backup_20190201_032757.ocr.305.999055677 0
[root@rac1 bin]#
·
Export OLR
ocrconfig –export
<filename>
[root@rac1 bin]# ./ocrconfig -export
/newbkp/ocr-export
PROT-58: successfully exported the Oracle
Cluster Registry contents to file '/newbkp/ocr-export'
[root@rac1 bin]# ls -lrt /newbkp/ocr-export
-rw-------. 1 root root 208896 Feb 1 13:40 /newbkp/ocr-export
[root@rac1 bin]#
It is recommended to multiplex
OCR to survive from failures and in 11gr2 we can have up to 5 copies of OCR.
In my current setup I have only
one copy of OCR on DATA diskgroup .
[root@rac1 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
[root@rac1 bin]#
ADD
To Add or multiplex OCR to other diskgroups FRA and CRS use the ADD command . I
will be having 3 copies of OCR after running the below ADD commands .
[root@rac1 bin]# ./ocrconfig -add +FRA
[root@rac1 bin]# ./ocrconfig -add +CRS
[root@rac1 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +FRA
Device/File Name : +CRS
DELETE
To drop /delete a copy of OCR use
DELETE command . Please note we cannot delete the only last copy of OCR .
[root@rac1 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +FRA
Device/File Name : +CRS
[root@rac1 bin]# ./ocrconfig -delete +CRS
[root@rac1 bin]# ./ocrconfig -delete +FRA
[root@rac1 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
[root@rac1 bin]# ./ocrconfig -delete +DATA
PROT-28: Cannot delete or replace the only
configured Oracle Cluster Registry location.
[root@rac1 bin]#
REPLACE
If we want to relocate OCR from
one diskgroup to another diskgroup use the replace command . Please note we
cannot replace the only copy of OCR from one disk group to another diskgroup .
In order to use REPLACE command we need to have atleast two copies of OCR and 3
diskgroups .
[root@rac1 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
[root@rac1 bin]# ./ocrconfig -replace +DATA
-replacement +CRS
PROT-28: Cannot delete or replace the only
configured Oracle Cluster Registry location.
[root@rac1 bin]#
[root@rac1 bin]# ./ocrconfig -add +FRA
[root@rac1 bin]# ./ocrcheck –config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +FRA
Relocate/replace OCR copy from
FRA to CRS diskgroup .
[root@rac1 bin]# ./ocrconfig -replace +FRA
-replacement +CRS
[root@rac1 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +CRS
[root@rac1 bin]#
REPAIR
If we make changes to cluster
configuration when a node is down we may need to run the repair command . In
12c It is observed that OCR is being
repaired automatically when we start the node which was down . for example we
have a 2 node RAC .Node 2 was down and we have replaced OCR from CRS diskgroup to FRA diskgroup from Node 1 .Node 2 is not aware of this change and
when we bring up the Node 2 it would fail to start as the configuration is
mismatch . In 12c this is being repaired internally we can see this in the
alert log . On Node 2 if crsd failed to start then we need to run the repair
command .
Node:1 UP
[root@rac1 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +CRS
[root@rac1 bin]# cat /etc/oracle/ocr.loc
#Device/file
+FRA/rac-cluster/OCRFILE/registry.255.999094315 getting replaced by device
+CRS/rac-cluster/OCRFILE/registry.255.999094341
ocrconfig_loc=+DATA/rac-cluster/OCRFILE/registry.255.982502039
ocrmirrorconfig_loc=+CRS/rac-cluster/OCRFILE/registry.255.999094341
[root@rac1 bin]# ./ocrconfig -replace +CRS -replacement +FRA
[root@rac1 bin]# cat /etc/oracle/ocr.loc
#Device/file +CRS/rac-cluster/OCRFILE/registry.255.999094341
getting replaced by device +FRA/rac-cluster/OCRFILE/registry.255.999095087
ocrconfig_loc=+DATA/rac-cluster/OCRFILE/registry.255.982502039
ocrmirrorconfig_loc=+FRA/rac-cluster/OCRFILE/registry.255.999095087
local_only=false[root@rac1 bin]# ./ocrcheck
-config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +FRA
[root@rac1 bin]#
Node :2 Down
[root@rac2 bin]# cat /etc/oracle/ocr.loc
#Device/file
+FRA/rac-cluster/OCRFILE/registry.255.999094315 getting replaced by device
+CRS/rac-cluster/OCRFILE/registry.255.999094341
ocrconfig_loc=+DATA/rac-cluster/OCRFILE/registry.255.982502039
ocrmirrorconfig_loc=+CRS/rac-cluster/OCRFILE/registry.255.999094341
[root@rac2 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +CRS
Start Node 2
[root@rac2 bin]# ./crsctl start crs
CRS-4123: Oracle High Availability Services has
been started.
## ALERT LOG
##
2019-02-01 14:27:24.624 [CRSD(17465)]CRS-8500:
Oracle Clusterware CRSD process is starting with operating system process ID
17465
2019-02-01 14:27:43.047 [CRSD(17465)]CRS-1009: The OCR configuration is invalid.
Details in /u01/app/oracle/diag/crs/rac2/crs/trace/crsd.trc.
2019-02-01 14:27:43.148 [CRSD(17465)]CRS-1018: Automatically repaired invalid
Oracle Cluster Registry configuration on this node. Details at (:PROCR00005:) in
/u01/app/oracle/diag/crs/rac2/crs/trace/crsd.trc.
2019-02-01 14:27:54.265 [CRSD(17465)]CRS-1012:
The OCR service started on node rac2.
2019-02-01 14:27:54.544 [CRSD(17465)]CRS-1201:
CRSD started on node rac2.
##
### TRACE FILE ###
OCRUTL:3010035744: u_fill_errorbuf: Error Info : [Configuration in the
OCR metadata did not match the local OCR configuration]
2019-02-01 14:27:43.055 : default:3010035744:
clsvactversion:4: Retrieving Active Version from local storage.
2019-02-01 14:27:43.063 : OCRRAW:3010035744: proprrepauto: Replacing configuration [1] with
device [+FRA/rac-cluster/OCRFILE/registry.255.999095087]. Previous
configuration [+CRS/rac-cluster/OCRFILE/registry.255.999094341]
2019-02-01 14:27:43.143 : OCRRAW:3010035744: u_masmd:11:
clscrs_register_resource2 succeeded [0]. Return [0]
OCRRAW:3010035744: (:PROCR00005:)proprrepauto: Successfully retrieved
the OCR configuration published by Cache Writer and automatically updated the
local OCR configuration.
2019-02-01 14:27:43.150 : OCRRAW:3010035744: proprio_repairconf: Successfully auto repaired the
local configuration.
2019-02-01 14:27:43.150 : OCRRAW:3010035744: proprioo: Successfully
auto repaired the OCR configuration
##
[root@rac2 bin]# ./ocrcheck -config
Oracle Cluster Registry configuration is :
Device/File Name : +DATA
Device/File Name : +FRA
[root@rac2 bin]# cat /etc/oracle/ocr.loc
#Device/file
+CRS/rac-cluster/OCRFILE/registry.255.999094341 getting replaced by device
+FRA/rac-cluster/OCRFILE/registry.255.999095087
ocrconfig_loc=+DATA/rac-cluster/OCRFILE/registry.255.982502039
ocrmirrorconfig_loc=+FRA/rac-cluster/OCRFILE/registry.255.999095087
local_only=false[root@rac2 bin]#
If we had to
run the repair command
./ocrcheck –repair –replace +CRS –replacmenet +FRA
How to Restore OCR from Backup when OCR is missing or
corrupted.
Ø
Check the current location of OCR backups
[root@rac1 bin]# ./ocrconfig -showbackup
PROT-24: Auto backups for the Oracle Cluster
Registry are not available
rac1
2019/02/01 15:35:34
+FRA:/rac-cluster/OCRBACKUP/backup_20190201_153534.ocr.331.999099335 0
rac2
2019/02/01 13:33:54
+FRA:/rac-cluster/OCRBACKUP/backup_20190201_133354.ocr.328.999092035 0
rac2
2019/02/01 03:27:57 +DATA:/rac-cluster/OCRBACKUP/backup_20190201_032757.ocr.305.999055677 0
Ø
Stop CRS
./crsctl stop crs
Ø
Start CRS in exclusive mode .
./crsctl start crs –excl
Ø
If crsd is running stop it .
[root@rac1 bin]# ./crsctl status res ora.crsd
-init
NAME=ora.crsd
TYPE=ora.crs.type
TARGET=ONLINE
STATE=INTERMEDIATE on rac1
[root@rac1 bin]# ./crsctl stop res ora.crsd
-init
CRS-2673: Attempting to stop 'ora.crsd' on
'rac1'
CRS-2677: Stop of 'ora.crsd' on 'rac1'
succeeded
[root@rac1 bin]#
Ø
Restore OCR from backup
[root@rac1 bin]# ./ocrconfig -restore
+FRA:/rac-cluster/OCRBACKUP/backup_20190201_153534.ocr.331.999099335
[root@rac1 bin]#
Ø
Run integrity check using ocrcheck
[root@rac1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows
:
Version : 4
Total space (kbytes) : 409568
Used space (kbytes) : 2260
Available space (kbytes) :
407308
ID : 766264505
Device/File Name : +CRS
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
[root@rac1 bin]#
Ø
Stop and Start CRS
./crsctl stop crs
./crsctl start crs
Ø
Run Cluvfy as GRID user
[oracle@rac1 ~]$ cluvfy comp ocr -n all
-verbose
Verifying OCR Integrity ...PASSED
Verification of OCR integrity was successful.
CVU operation performed: OCR integrity
Date: Feb 1, 2019 4:25:22 PM
CVU home: /u01/app/12.2.0.1/grid/
User: oracle
[oracle@rac1 ~]$
No comments:
Post a Comment