Thursday, September 1, 2011

How to Move OCR and Voting Disk to ASM Diskgroup in 11gR2

Case: Moving to Redhat Linux 5/Oracle Enterprise Linux 5, which does not support Raw filesytem. Steps: (these steps can be performanced on 11gR2) 1.) Check the current location of ocr file:

[root@host1 bin]# ocrcheck
Status of Oracle Cluster Registry is as follows :
	 Version                  :          3
	 Total space (kbytes)     :     262120
	 Used space (kbytes)      :       3004
	 Available space (kbytes) :     259116
	 ID                       :  798462606
	 Device/File Name         : /mnt/cludata/ocrfile
                                    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
2.) Add a Mirror OCR location else you might encounter error :PROT-28: Cannot delete or replace the only configured Oracle Cluster Registry location
i.) Create the file (as root)
cp /dev/null /mnt/cludata/ocrmirror 
chown root:dba /mnt/cludata/ocrmirror 
chmod 640 /mnt/cludata/ocrmirror
[root@host1 cludata]# pwd
/rmanbkp1/cludata
[root@host1 cludata]# ls -lrt
total 23784
-rw-r----- 1 root   dba 272756736 Aug 31 12:37 ocrfile
-rw-r----- 1 root   dba         0 Aug 31 13:12 ocrmirror
-rw-r----- 1 oracle dba  21004288 Aug 31 13:12 cssfile

ii.) Add the mirror OCR file
[root@host1 cludata]# ocrconfig -add /rmanbkp1/cludata/ocrmirror
[root@host1 cludata]# ocrcheck
Status of Oracle Cluster Registry is as follows :
	 Version                  :          3
	 Total space (kbytes)     :     262120
	 Used space (kbytes)      :       3004
	 Available space (kbytes) :     259116
	 ID                       :  798462606
	 Device/File Name         : /mnt/cludata/ocrfile
                                    Device/File integrity check succeeded
	 Device/File Name         : /mnt/cludata/ocrmirror
                                    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
3.) Check ASM Diskgroup compatibility (login as sqlplus / as sysasm)
col name format a10
col COMPATIBILITY format a20
col DATABASE_COMPATIBILITY format a20
select name,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;

NAME	   COMPATIBILITY	DATABASE_COMPATIBILI
---------- -------------------- --------------------
DG_ARCH01  10.1.0.0.0		10.1.0.0.0
DG_SYS01   10.1.0.0.0		10.1.0.0.0
DG_TEMP01  10.1.0.0.0		10.1.0.0.0
DG_DATA01 10.1.0.0.0		10.1.0.0.0
4.) Upgrade the compatibility to 11.2 compatible.asm
SQL> alter diskgroup DG_ARCH01 set attribute 'compatible.asm'='11.2';
Diskgroup altered.
SQL> alter diskgroup DG_SYS01 set attribute 'compatible.asm'='11.2';
Diskgroup altered.
SQL> alter diskgroup DG_TEMP01 set attribute 'compatible.asm'='11.2';
Diskgroup altered.
SQL> alter diskgroup DG_DATA01 set attribute 'compatible.asm'='11.2';
Diskgroup altered.

SQL> select name,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;
NAME	   COMPATIBILITY	DATABASE_COMPATIBILI
---------- -------------------- --------------------
DG_ARCH01  11.2.0.0.0		10.1.0.0.0
DG_SYS01   11.2.0.0.0		10.1.0.0.0
DG_TEMP01  11.2.0.0.0		10.1.0.0.0
DG_DATA01 11.2.0.0.0		10.1.0.0.0
Update compatible.rdbms
SQL> alter diskgroup DG_ARCH01 set attribute 'compatible.rdbms'='11.2';
Diskgroup altered.
SQL> alter diskgroup DG_SYS01 set attribute 'compatible.rdbms'='11.2';
Diskgroup altered.
SQL> alter diskgroup DG_TEMP01 set attribute 'compatible.rdbms'='11.2';
Diskgroup altered.
SQL> alter diskgroup DG_DATA01 set attribute 'compatible.rdbms'='11.2';
Diskgroup altered.

SQL> select name,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;
NAME	   COMPATIBILITY	DATABASE_COMPATIBILI
---------- -------------------- --------------------
DG_ARCH01  11.2.0.0.0		11.2.0.0.0
DG_SYS01   11.2.0.0.0		11.2.0.0.0
DG_TEMP01  11.2.0.0.0		11.2.0.0.0
DG_DATA01 11.2.0.0.0		11.2.0.0.0
5.) Move OCR file to ASM:
ocrconfig -replace /rmanbkp1/cludata/ocrfile -replacement +DG_ARCH01
ocrconfig -replace /rmanbkp1/cludata/ocrmirror -replacement +DG_SYS01
6.) Check OCR:
[root@host1 cludata]# ocrcheck
Status of Oracle Cluster Registry is as follows :
	 Version                  :          3
	 Total space (kbytes)     :     262120
	 Used space (kbytes)      :       3004
	 Available space (kbytes) :     259116
	 ID                       :  798462606
	 Device/File Name         : +DG_ARCH01
                                    Device/File integrity check succeeded
	 Device/File Name         :  +DG_SYS01
                                    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
7.) Restart CRS to check if it comes back fine.
NOTE: You will not be able to stop just ASM now, as the OCR file is in ASM
8.) Check OCR:( as oracle user )
[oracle@host1]~% /home/oragrid/product/11.2/bin/cluvfy comp ocr -n all -verbose

Verifying OCR integrity 

Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations

ASM Running check passed. ASM is running on all cluster nodes

Checking OCR config file "/etc/oracle/ocr.loc"...

OCR config file "/etc/oracle/ocr.loc" check successful

Disk group for ocr location "+DG_SYS01" available on all the nodes

Disk group for ocr location "+DG_ARCH01" available on all the nodes

Checking size of the OCR location "+DG_SYS01" ...

Size check for OCR location "+DG_SYS01" successful...
Size check for OCR location "+DG_SYS01" successful...
Size check for OCR location "+DG_SYS01" successful...
Size check for OCR location "+DG_SYS01" successful...

Checking size of the OCR location "+DG_ARCH01" ...

Size check for OCR location "+DG_ARCH01" successful...
Size check for OCR location "+DG_ARCH01" successful...
Size check for OCR location "+DG_ARCH01" successful...
Size check for OCR location "+DG_ARCH01" successful...

WARNING: 
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. 
9.) Move Voting disk now
[root@host1 cludata]# crsctl replace votedisk +DG_ARCH01
CRS-4256: Updating the profile
Successful addition of voting disk aa5d2a1024384faebf3f2c108e6b203a                                                                                                                                                                                                                                .
Successful deletion of voting disk 253472991d324fb9bfab1f1301385697.
Successfully replaced voting disk group with +DG_ARCH01.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
10.) Check Voting Disk:
[root@host1 cludata]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   aa5d2a1024384faebf3f2c108e6b203a (ORCL:DISK2) [DG_ARCH01]
Located 1 voting disk(s).
[root@host1 cludata]# crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
11.) Check contents of ocr.loc file
[root@host1 cludata]# more /etc/oracle/ocr.loc
#Device/file /mnt/cludata/ocrmirror getting replaced by device +DG_SYS01 
ocrconfig_loc=+DG_ARCH01
ocrmirrorconfig_loc=+DG_SYS01
local_only=false
ALL LOOKS GOOD NOW !!!

2 Comments:

Wahid Khan said...

Good one Apun !!!

Rrgds
Wahid Khan

Unknown said...

Good one apun bhai.