Pages

Tuesday 24 September 2013

Renaming the ASM DISKGROUP

Note : For this post I have referred the other source. Just for knowledge sharing i have shared the same info here :) 
Some of the times we might face the situation to change the name of the Diskgroup, The same senario has been replicated here :
SELECT NAME,STATE FROM V$ASM_DISKGROUP;
NAME                         STATE
—————————- ————
ARCHLOG                      MOUNTED
DATAFILE_ORAPROD6            MOUNTED
DATAFILE_ORAPRD7             MOUNTED
LOG1                         MOUNTED
LOG2                         MOUNTED
Before to start the actual migration found DATAFILE_ORAPRD7 dg has typo error it should be like DATAFILE_ORAPRD7 so Instead of dropping the diskgroup I decided to go for rename it.
Below are the steps which I followed to rename Diskgroup in 11.2 grid environment.
First we need to dismount the DG which we are going to rename.
Stop ASM Diskgroup.
oracle:+ASM@linuxprd5 /oracle > asmcmd umount DATAFILE_ORAPRD7
Check the Status of Diskgroup.
oracle:+ASM@linuxprd5 /oracle > crsctl stat res ora.DATAFILE_ORAPRD7.dg
NAME=ora.DATAFILE_ORAPRD7.dg
TYPE=ora.diskgroup.type
TARGET=OFFLINE
STATE=OFFLINE
Now we are good to go for Renaming Diskgroup.
Inorder to Rename any diskgroup in 11.2 gird we can use “renamedg” command.
oracle:+ASM@linuxprd5 /oracle > renamedg phase=both dgname=DATAFILE_ORAPRD7 newdgname=DATAFILE_ORAPROD7 verbose=true
Parsing parameters..
Parameters in effect:
         Old DG name       : DATAFILE_ORAPRD7
         New DG name          : DATAFILE_ORAPROD7
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        : (null)
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: phase=both dgname=DATAFILE_ORAPRD7 newdgname=DATAFILE_ORAPROD7 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:DATA_DISK1 with disk number:0 and timestamp (32971243 -722582528)
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA_DISK2 with disk number:1 and timestamp (32971243 -722582528)
Checking for hearbeat…
Re-discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA_DISK1 with disk number:0 and timestamp (32971243 -722582528)
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA_DISK2 with disk number:1 and timestamp (32971243 -722582528)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:0
Checking disk number:1
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for ORCL:DATA_DISK1
Modifying the header
Looking for ORCL:DATA_DISK2
Modifying the header
Completed phase 2
Terminating kgfd context 0x2b4c8410a0a0
oracle:+ASM@linuxprd5 /oracle >
Connect to ASM Instance and verify the new diskgroup name.
oracle:+ASM@linuxprd5 /oracle > sqlplus / as sqlasm
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jun 19 03:17:26 2012


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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Automatic Storage Management option


SQL> select name ,state from v$asm_diskgroup;
NAME                          STATE
—————————– —————-
DATAFILE_ORAPROD7             DISMOUNTED  —> Diskgroup got Renamed Now.
DATAFILE_ORAPROD6             MOUNTED
ARCHLOG                       MOUNTED
LOG1                          MOUNTED
LOG2                          MOUNTED


SQL> alter diskgroup DATAFILE_ORAPROD7 mount;
Diskgroup altered.


SQL> select name ,state from v$asm_diskgroup;
NAME                          STATE
—————————– ————-
DATAFILE_ORAPROD7             MOUNTED
DATAFILE_ORAPROD6             MOUNTED
ARCHLOG                       MOUNTED
LOG1                          MOUNTED
LOG2                          MOUNTED
After Renaming the diskgroup we need to remove old diskgroup name from the cluster resource also.
oracle:+ASM@linuxprd5 /oracle > crsctl stat res -t
——————————————————————————–
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
——————————————————————————–
Local Resources
——————————————————————————–
ora.ARCHLOG.dg
               ONLINE  ONLINE       linuxprd5
ora.DATAFILE_ORAPROD6.dg
               ONLINE  ONLINE       linuxprd5
ora.DATAFILE_ORAPRD7.dg
               OFFLINE OFFLINE      linuxprd5   –> Still this resource is not removed from the cluster but its in OFFLINE.
ora.DATAFILE_COORAPROD73A.dg
               ONLINE  ONLINE       linuxprd5
ora.LOG1.dg
               ONLINE  ONLINE       linuxprd5
ora.LOG2.dg
               ONLINE  ONLINE       linuxprd5
ora.asm
               ONLINE  ONLINE       linuxprd5                 Started
ora.ons
               OFFLINE OFFLINE      linuxprd5
——————————————————————————–
Cluster Resources
——————————————————————————–
ora.cssd
      1        ONLINE  ONLINE       linuxprd5
ora.diskmon
      1        OFFLINE OFFLINE
ora.evmd
      1        ONLINE  ONLINE       linuxprd5
Below are the detailed info for the new and old diskgroup resource status.
oracle:+ASM@linuxprd5 /oracle > crsctl stat res ora.DATAFILE_ORAPRD7.dg ora.DATAFILE_ORAPROD7.dg
NAME=ora.DATAFILE_ORAPRD7.dg
TYPE=ora.diskgroup.type
TARGET=OFFLINE
STATE=OFFLINE


NAME=ora.DATAFILE_ORAPROD7.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on linuxprd5
To remove diksgroup from the cluster resource we can use SRVCTL command.
oracle:+ASM@linuxprd5 /oracle > srvctl remove diskgroup -g DATAFILE_ORAPRD7


oracle:+ASM@linuxprd5 /oracle > crsctl stat res -t
——————————————————————————-
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
——————————————————————————-
Local Resources
——————————————————————————-
ora.ARCHLOG.dg
               ONLINE  ONLINE       linuxprd5
ora.DATAFILE_ORAPROD6.dg
               ONLINE  ONLINE       linuxprd5
ora.DATAFILE_ORAPROD7.dg
               ONLINE  ONLINE       linuxprd5
ora.LOG1.dg
               ONLINE  ONLINE       linuxprd5
ora.LOG2.dg
               ONLINE  ONLINE       linuxprd5
ora.asm
               ONLINE  ONLINE       linuxprd5                 Started
ora.ons
               OFFLINE OFFLINE      linuxprd5
——————————————————————————-
Cluster Resources
——————————————————————————-
ora.cssd
      1        ONLINE  ONLINE       linuxprd5
ora.diskmon
      1        OFFLINE OFFLINE
ora.evmd
      1        ONLINE  ONLINE       linuxprd5
****************************Happy Learning *******************************

No comments:

Post a Comment