Friday 14 October 2011

How to move the OCR diskgroup contents to another group online


How to move the OCR diskgroup contents to another group online in a RAC enviornment


Sometime due to some reason we may need to move the ocr contents to new diskgroup , the reason could be like Asm lable is wrong,diskmapper is wrong,disk is having problem,disk location need to be changed,


1. Check the current Disk Group name

[root@ocservera 11.2.0.2]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3284
         Available space (kbytes) :     258836
         ID                       : 1837802780
         Device/File Name         :       +OCR
                                    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. Create another diskgroup

CREATE DISKGROUP OCR1
  external redundancy
   disk 'ORCL:ASM_DISK_0011',
         'ORCL:ASM_DISK_0012',
    attribute 'compatible.asm' = '11.2',
            'compatible.advm' = '11.2'
  /
Diskgroup created.

3. Verify through asmcmd or sqlplus

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576      3057     1372              563             404              0                           Y  OCR/
MOUNTED  NORMAL  N         512   4096  1048576    558030   556983              349          278317              0                      N  OCR1/
ASMCMD> exit

4. Add the OCR to the new DISK group

[root@ocservera 11.2.0.2]# ocrconfig -add +OCR1

5 . Verify if new disk has been added.

[root@ocservera 11.2.0.2]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3304
         Available space (kbytes) :     258816
         ID                       : 1837802780
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded
         Device/File Name         :      +OCR1
                                    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

6. Delete the ocr from the old diskgroup

[root@ocservera 11.2.0.2]# ocrconfig -delete +OCR

7. Check ocr is moved to new diskgroup

[root@ocservera 11.2.0.2]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3304
         Available space (kbytes) :     258816
         ID                       : 1837802780
         Device/File Name         :      +OCR1
                                    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


8. Move the voting disk from the current diskgroup to new diskgroup

8.1 Verify the current location

crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   a63ccacdc0b84f6cbfeeeee913657936 (ORCL:ASM_OCR_0001P1) [OCR]
 2. ONLINE   15f320594b7d4fbdbf6fb952b3665683 (ORCL:ASM_OCR_0002P1) [OCR]
 3. ONLINE   1e80bcca0d994fc5bfc403e9ce01b951 (ORCL:ASM_OCR_0003P1) [OCR]

8.2 replcate the disk group.
crsctl replace votedisk +OCR1

Successful addition of voting disk 1a8593de9c654f77bf7d55440dc20ce0.
Successful addition of voting disk 49e5d45ebe874f7fbfbc514fa51cc641.
Successful addition of voting disk 248240fba9784f57bf2021416760d415.
Successful deletion of voting disk a63ccacdc0b84f6cbfeeeee913657936.
Successful deletion of voting disk 15f320594b7d4fbdbf6fb952b3665683.
Successful deletion of voting disk 1e80bcca0d994fc5bfc403e9ce01b951.
Successfully replaced voting disk group with +OCR1.
CRS-4266: Voting file(s) successfully replaced


8.3 verify the current location

[oragrid@ocservera ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   1a8593de9c654f77bf7d55440dc20ce0 (ORCL:ASM_FRA_0001) [OCR1]
 2. ONLINE   49e5d45ebe874f7fbfbc514fa51cc641 (ORCL:ASM_FRA_0002) [OCR1]
 3. ONLINE   248240fba9784f57bf2021416760d415 (ORCL:ASM_FRA_0003) [OCR1]
Located 3 voting disk(s).

8.4 Verify using asmcmd if voting disk is 'Y' against the disk group

[oragrid@ocservera ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576      3057     1468              531             468              0             N  OCR/
MOUNTED  NORMAL  N         512   4096  1048576    558030   556342              563          277889              0             Y  OCR1/


9. move the spfile to new diskgroup using spmove

   9.1 create spfile directory in the new diskgroup
        asmcmd> mkdir +OCR1/ocserver-cl/asmparameterfile

  9.2  spmove will copy the current spfile to the new location and update the gpn profile for next startup. This command throw erros as not all alterations performed as current spfile is being used, in the next startup
        the new spfile will be effective and we can manually remove the old spfile.
       
            ASMCMD> spmove +OCR/ocserver-cl/asmparameterfile/registry.253.762275705 +OCR1/ocserver-cl/asmparameterfile/spfileASM.ora
            ORA-15032: not all alterations performed
          ORA-15028: ASM file '+DATA/asm/asmparameterfile/REGISTRY.253.715881237' not dropped; currently being accessed (DBD ERROR: OCIStmtExecute
 Alternatively we can do this using the below steps Ref:How to move ASM spfile to a different disk group [ID 1082943.1
To move ASM spfile to another disk group, either make use of intermediate pfile:
Create intermediate pfile from the current spfile
Create spfile in a new disk group from the intermediate pfile
Restart the HA stack to verify that ASM starts up fine with moved spfile
Remove the original spfile
or use 'asmcmd spcopy' command
Copy spfile with -u option - to update GPnP profile in RAC environment
Restart the HA stack to verify that ASM starts up fine with copiedspfile
Remove the original spfile
  9.3 . Restart the HA stack to verify that ASM starts up fine with moved spfile
          crsctl stop cluster -all
          crsctl start cluster -all

9.4. Verify spfile has been changed

[oragrid@ocservera ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Sep 26 15:12:42 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

SQL> conn / as sysasm
Connected.
SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +OCR1/ocserver-cl/asmparamete
                                                 rfile/spfileasm.ora
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

10. Dismount the ocr diskgroup from all the instances

SQL> alter diskgroup ocr mount;

Diskgroup altered.

if the disk group is used or mounted by any of the process/instance we may get the below error

ASMCMD> dropdg -r -f OCR
ORA-15039: diskgroup not dropped
ORA-15073: diskgroup OCR is mounted by another ASM instance (DBD ERROR: OCIStmtExecute)

11. Beside spfile,ocr,votingdisk if any of the files are created, please remove the files manualy using asmcmd rm command or drop/move the files from the respective database

12. Now we are ready to drop the diskgroup
 dropdg -r -f OCR

13. Verify all are intact.
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576    558030   556342              563          277889              0             Y  OCR1/







4 comments:

  1. Thanks for the steps. I had to do this in a hurry in my environment and couldn't go through the jazz of document.

    Thanks.

    ReplyDelete
  2. Nice artical, Thanks for sharing.

    ReplyDelete
  3. Very nice document it is very useful and easy to understand.

    ReplyDelete
  4. Thanks for sharing, but I have question, what if we want to migrate the disk but on the 1 diskgroup contains data, ocr, votedisk, and asm spfile.
    we want to migrate all disk to another SAN. can we just add disk and drop old disk ?

    ReplyDelete

ZFS

Public Cloud tools comparison