Tuesday, June 22, 2010

Renaming ASM Disk group in Oracle 11gR2:

Renaming ASM Disk group in Oracle 11gR2:


The renamedg utility is new in Oracle 11gR2 and it's documented in the storage administrator’s guide.
You can use this tool to rename ASM diskgroups. The prerequisite is to unmount the disk group on all cluster nodes.
The tool works in 2 phases, in the first phase it generates a configuration file and in the second phase it discovers the disks and rename the disk group.



How to use renamedg command to rename the ASM diskgroup?

The following example demonstrates how to rename the ASM diskgroup from A_DATA to B_DATA.


a. Setup the environment:

$ . oraenv
+ASM1

$ export PATH=$PATH:/dev/oracleasm/disks
$ echo $PATH


b. Dismount the ASM diskgroup to be renamed on all cluster nodes:

$ asmcmd umount A_DATA -- on all nodes.


c. Verify the diskgroup was dismounted:

$ crsctl status resource ora.A_DATA.dg

NAME=ora.A_DATA.dg
TYPE=ora.diskgroup.type
TARGET=OFFLINE, OFFLINE
STATE=OFFLINE, OFFLINE


d. Using renamedg utility to rename the diskgroup:

$ renamedg phase=both dgname=A_DATA newdgname=B_DATA verbose=true


Output:
----***********----
Parsing parameters..

Parameters in effect:

Old DG name : A_DATA
New DG name : B_DATA
Phases :
Phase 1
Phase 2
Discovery str : (null)
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=A_DATA newdgname=B_DATA verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0681 with disk number:0 and timestamp (32937868 1717605376)
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0685 with disk number:1 and timestamp (32937868 1717605376)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0681 with disk number:0 and timestamp (32937868 1717605376)
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0685 with disk number:1 and timestamp (32937868 1717605376)
Checking if the diskgroup is mounted
Checking disk number:0
Checking disk number:1
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for ORCL:S_1873_0681
Modifying the header
Looking for ORCL:S_1873_0685
Modifying the header
Completed phase 2
Terminating kgfd context 0x2b06e27d20a0
----***********----


e. Mounting the ASM diskgroup:

$ asmcmd mount B_DATA -- on all nodes.


f. Check if the diskgroup was renamed and mounted successfully:

$ crsctl status resource ora.B_DATA.dg

NAME=ora.B_DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on atld380, ONLINE on atld381

Yaaa, diskgroup has been renamed from A_DATA to B_DATA successfully.



Possible error when issuing renamedg command:

Error: "KFNDG-00408: disk (string:string) could not be discovered error"
Solution: Add the ASM disk path to $PATH environment variable "export PATH=$PATH:/dev/oracleasm/disks"


Output:
----***********----
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0638 with disk number:0 and timestamp (32937868 354065408)
Checking if the diskgroup is mounted
Checking disk number:0
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for ORCL:S_1873_0638
ERROR: -9(Error 7217, OS Error ()
)KFNDG-00408: file not found; arguments: [] [ORCL:S_1873_0638]


Terminating kgfd context 0x2b3ddb1d80a0
----***********----



The renamedg command usage:

$ renamedg -help

Parsing parameters..
phase Phase to execute (phase=ONE|TWO|BOTH), default BOTH

dgname Diskgroup to be renamed

newdgname New name for the diskgroup

config intermediate config file

check just check-do not perform actual operation,
(check=TRUE/FALSE), default FALSE

confirm confirm before committing changes to disks,
(confirm=TRUE/FALSE), default FALSE

clean ignore errors (clean=TRUE/FALSE), default TRUE

asm_diskstring ASM Diskstring (asm_diskstring='discoverystring',
'discoverystring1' ...)

verbose verbose execution (verbose=TRUE|FALSE), default
FALSE

keep_voting_files Voting file attribute,
(keep_voting_files=TRUE|FALSE), default FALSE


Q:
a.
Do we need to modify the asm_diskgroups initialization parameter after renaming the disk groups?

No, you don’t have to. The renamedg utility is smart enough to update the asm_diskgroups initialization parameter.


b.
How do I rename the ASM disk group with datafile in it?

After rename the disk group, start the database in MOUNT mode and rename the datafiles using "ALTER DATABASE RENAME FILE . . . TO . . ." command to OPEN the database.


c.
Does it mater how many disks in the disk group?

No, tried with 2 disks DG and also with 8 disks DG.

3 comments:

Coskan Gundogar said...

thanks mate you are a lifesaver.

One think though its not documented anywhere can I ask you where did you get the information about setting /dev/oracleasm/disks for the PATH value.

Was it from Oracle support ?

Unknown said...

thanks Guru.These steps are very helpful

Bradford Leak said...

Perfect... this was exactly what I needed.