ASM operation : Rename Diskgroup

Current status and quick overview

  • Step 1: dismount the DG TEST  
  • Step 2: Validate rename DG operation by running  remamedg  command with check  options ( non destructive ) :  verbose=true check=true
  • Step 3: Change DG name  without check options     :  verbose=true   -
  • Step 4: mount the new DG TEST2 
  • Step 5: Cleanup OCR and delete old  DG TEST
Note renaming a DG with CW related files ( voting disks, OCR ) needs additional steps 
  ( For details  see Book: The Essential Guide to Oracle Automatic Storage Management - Chapater 13 ) 

Current statuscrs | egrep 'TARGET|TEST'
NAME                           TARGET     STATE           SERVER       STATE_DETAILS   
ora.TEST.dg                    ONLINE     ONLINE          grac41        
ora.TEST.dg                    ONLINE     ONLINE          grac42        
ora.TEST.dg                    ONLINE     ONLINE          grac43      
[grid@grac41 ~]$ asmcmd lsdg test
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      2046     1746                0             873              0             N  TEST/
[grid@grac41 ~]$  asmcmd lsdsk -k
Total_MB  Free_MB  OS_MB  Name       Failgroup  Failgroup_Type  Library  Label  UDID  Product  Redund   Path
    1023      873   1023  TEST_0000  TEST_0000  REGULAR         System                         UNKNOWN  /dev/asm_test_1G_disk1
    1023      873   1023  TEST_0001  TEST_0001  REGULAR         System                         UNKNOWN  /dev/asm_test_1G_disk2
--> DG TEST hs 2 disks and is mounted on all cluster nodes

Dismount DG test

[grid@grac41 ~]$ sqlplus / as sysasm

SQL> alter diskgroup test dismount;
alter diskgroup test dismount
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15027: active use of diskgroup "TEST" precludes its dismount

SQL>  alter diskgroup test dismount force;
Diskgroup altered.

Run renamedg with check option  to validate the RENAME DG operation

[grid@grac41 ~]$  renamedg dgname=test newdgname=test_new verbose=true check=true asm_disksting='/dev/asm*'
Parsing parameters..
KFNDG-00201: file not found
KFNDG-00201: invalid arguments
    Cause: Invalid key or value was specified for renamedg.
    Action: Try renamedg -help for more information.
--> Wrong parameter:  Change asm_disksting to  asm_diskstring 


[grid@grac41 ~]$  renamedg dgname=test newdgname=test_new verbose=true check=true asm_diskstring='/dev/asm*'
..
KFNDG-00405: specified disk group string appears to be mounted
    Cause: Disk group was mounted.
    Action: Unmount the disk group and retry renamedg.
[grid@grac41 ~]$  asmcmd lsdg test -g
Inst_ID  State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
      3  MOUNTED  NORMAL  N         512   4096  1048576      2046     1746                0             873              0             N  TEST/
      2  MOUNTED  NORMAL  N         512   4096  1048576      2046     1746                0             873              0             N  TEST/
--> DG test still mounted on 2 RAC instances 
    Either use asmca with option dismount DG on all nodes  or run  alter diskgroup test dismount force on the remaining nodes

[grid@grac41 ~]$  asmcmd lsdg test -g
ASMCMD-8001: diskgroup 'test' does not exist or is not mounted

[grid@grac41 ~]$   renamedg dgname=test newdgname=test_new verbose=true check=true asm_diskstring='/dev/asm*'
Parsing parameters..
Parameters in effect:
     Old DG name       : TEST 
     New DG name       : TEST_NEW 
     Phases            :
          Phase 1
          Phase 2
     Discovery str        : /dev/asm* 
     Check              : TRUE
     Clean              : TRUE
     Raw only           : TRUE
renamedg operation: dgname=test newdgname=test_new verbose=true check=true asm_diskstring=/dev/asm*
Executing phase 1
Discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm_test_1G_disk2 with disk number:1 and timestamp (33004974 -2144396288)
Identified disk UFS:/dev/asm_test_1G_disk1 with disk number:0 and timestamp (33004974 -2144396288)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm_test_1G_disk2 with disk number:1 and timestamp (33004974 -2144396288)
Identified disk UFS:/dev/asm_test_1G_disk1 with disk number:0 and timestamp (33004974 -2144396288)
Checking if the diskgroup is mounted or used by CSS 
Checking disk number:1
Checking disk number:0
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/asm_test_1G_disk2
Leaving the header unchanged
Looking for /dev/asm_test_1G_disk1
Leaving the header unchanged
Completed phase 2
Terminating kgfd context 0x7f6f0781a0a0

Run renamedg without check option to RENAME DG from TEST to TEST_NEW

[grid@grac41 ~]$    renamedg dgname=test newdgname=test_new verbose=true   asm_diskstring='/dev/asm*'
Parsing parameters..
Parameters in effect:

      Old DG name         : TEST 
     New DG name          : TEST_NEW 
     Phases               :
          Phase 1
          Phase 2
     Discovery str        : /dev/asm* 
     Clean              : TRUE
     Raw only           : TRUE
renamedg operation: dgname=test newdgname=test_new verbose=true asm_diskstring=/dev/asm*
Executing phase 1
Discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm_test_1G_disk2 with disk number:1 and timestamp (33004974 -2144396288)
Identified disk UFS:/dev/asm_test_1G_disk1 with disk number:0 and timestamp (33004974 -2144396288)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm_test_1G_disk2 with disk number:1 and timestamp (33004974 -2144396288)
Identified disk UFS:/dev/asm_test_1G_disk1 with disk number:0 and timestamp (33004974 -2144396288)
Checking if the diskgroup is mounted or used by CSS 
Checking disk number:1
Checking disk number:0
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/asm_test_1G_disk2
Modifying the header
Looking for /dev/asm_test_1G_disk1
Modifying the header
Completed phase 2
Terminating kgfd context 0x7ffae14fe0a0

Verify new DG paramter using kfed and mount DG test_new
[grid@grac41 ~]$ kfed  read  /dev/asm_test_1G_disk1 | grep 'name'
kfdhdb.dskname:               TEST_0000 ; 0x028: length=9
kfdhdb.grpname:                TEST_NEW ; 0x048: length=8
kfdhdb.fgname:                TEST_0000 ; 0x068: length=9
kfdhdb.capname:                         ; 0x088: length=0
[grid@grac41 ~]$ kfed  read  /dev/asm_test_1G_disk2  | grep 'name'
kfdhdb.dskname:               TEST_0001 ; 0x028: length=9
kfdhdb.grpname:                TEST_NEW ; 0x048: length=8
kfdhdb.fgname:                TEST_0001 ; 0x068: length=9
kfdhdb.capname:                         ; 0x088: length=0

Mount renamed DG test_new

SQL> alter diskgroup test_new mount;
Diskgroup altered.

[grid@grac41 ~]$ asmcmd lsdg -g test_new
Inst_ID  State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
      1  MOUNTED  NORMAL  N         512   4096  1048576      2046     1746                0             873              0             N  TEST_NEW/
--> DG test_new mounted on grac41 only -
    Again use asmca to mount DG test_new on the remaining nodes 
[grid@grac41 ~]$  asmcmd lsdg -g test_new
Inst_ID  State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
      1  MOUNTED  NORMAL  N         512   4096  1048576      2046     1746                0             873              0             N  TEST_NEW/
      2  MOUNTED  NORMAL  N         512   4096  1048576      2046     1746                0             873              0             N  TEST_NEW/
      3  MOUNTED  NORMAL  N         512   4096  1048576      2046     1746                0             873              0             N  TEST_NEW/

[grid@grac41 ~]$ asmcmd lsdsk -k 
Total_MB  Free_MB  OS_MB  Name       Failgroup  Failgroup_Type  Library  Label  UDID  Product  Redund   Path
    1023      873   1023  TEST_0000  TEST_0000  REGULAR         System                         UNKNOWN  /dev/asm_test_1G_disk1
    1023      873   1023  TEST_0001  TEST_0001  REGULAR         System                         UNKNOWN  /dev/asm_test_1G_disk2
--> Note disks are not renamed from  TEST_0000 to TEST_NEW_0000  and TEST_0001 to TEST_NEW_0001

Cleanup cluster resources

[grid@grac41 ~]$ crs | egrep 'NAME|TEST'
NAME                           TARGET     STATE           SERVER       STATE_DETAILS   
ora.TEST.dg                    OFFLINE    OFFLINE         grac41        
ora.TEST.dg                    OFFLINE    OFFLINE         grac42        
ora.TEST.dg                    OFFLINE    OFFLINE         grac43        
ora.TEST_NEW.dg                ONLINE     ONLINE          grac41        
ora.TEST_NEW.dg                ONLINE     ONLINE          grac42        
ora.TEST_NEW.dg                ONLINE     ONLINE          grac43       
--> old DG ora.TEST.dg is OFFLINE but still referenced by CW 

[grid@grac41 ~]$ srvctl remove diskgroup -g TEST
PRCA-1002 : Failed to remove CRS resource ora.TEST.dg for ASM Disk Group TEST
PRCR-1028 : Failed to remove resource ora.TEST.dg
PRCR-1072 : Failed to unregister resource ora.TEST.dg
CRS-0222: Resource 'ora.TEST.dg' has dependency error.

[grid@grac41 ~]$  crsctl status resource ora.grac4.db -p | grep -i test
START_DEPENDENCIES=hard(ora.DATA.dg,ora.FRA2.dg,ora.TEST.dg) weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) 
                   pullup(ora.DATA.dg,ora.FRA2.dg,ora.TEST.dg)
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.FRA2.dg,shutdown:ora.TEST.dg)

Remove start dependency:
[root@grac41 ~]# crsctl  modify resource  ora.grac4.db  -attr "START_DEPENDENCIES='hard(ora.DATA.dg,ora.FRA2.dg) 
                 weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) pullup(ora.DATA.dg,ora.FRA2.dg)' "
[root@grac41 ~]#   crsctl status resource ora.grac4.db -p | grep -i test
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.FRA2.dg,shutdown:ora.TEST.dg)
--> STOP DEPENDENCIES still there
Remove stop dependency:
[root@grac41 ~]# crsctl  modify resource  ora.grac4.db  -attr "STOP_DEPENDENCIES='hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.FRA2.dg)' "
[root@grac41 ~]# crsctl status resource ora.grac4.db -p | grep -i test
--> START and STOP DEPENDENCIES to DG TEST removed 

$ srvctl remove diskgroup -g TEST
[grid@grac41 ~]$ 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     40944    18471            10236            4117              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     40952    31275                0           31275              0             N  FRA2/
MOUNTED  NORMAL  N         512   4096  4194304      6132     4960             2044            1458              0             Y  OCR/
MOUNTED  NORMAL  N         512   4096  1048576      2046     1746                0             873              0             N  TEST_NEW/

References

  •  Book: The Essential Guide to Oracle Automatic Storage Management – Chapater 13 ( from Nitin Vengurlekar / Prasad Bagal – Oracle Press )

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>