How To Rename A Diskgroup On ASM 11gR2?

How To Rename A Diskgroup On ASM 11gR2?



GOAL

The present document provides a clear example about how to rename an ASM diskgroup on release 11gR2.

SOLUTION

1) First of all, the desired diskgroup needs to be dismounted (from each node if this is a RAC configuration):
# asmcmd umount DATA


2) Verify that the desired diskgroup was dismounted:
# 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 32756 31828 244 15792 0 N DATA_OCR/

MOUNTED EXTERN N 512 4096 1048576 16378 10134 0 10134 0 N LOBDATA/

3) Then execute the rename statement:
# renamedg phase=both dgname=DATA newdgname=DG_PROD_DATA verbose=true

Parsing parameters..

Parameters in effect:

Old DG name : DATA

New DG name : DG_PROD_DATA

Phases :

Phase 1

Phase 2

Discovery str : (null)

Clean : TRUE

Raw only : TRUE

renamedg operation: phase=both dgname=DATA newdgname=DG_PROD_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:DATA1 with disk number:0 and timestamp (32925601 -972709888)

Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA2 with disk number:1 and timestamp (32925601 -972709888)

Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA3 with disk number:2 and timestamp (32925601 -972709888)

Checking for hearbeat...

Re-discovering the group

Performing discovery with string:

Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA1 with disk number:0 and timestamp (32925601 -972709888)

Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA2 with disk number:1 and timestamp (32925601 -972709888)

Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:DATA3 with disk number:2 and timestamp (32925601 -972709888)

Checking if the diskgroup is mounted

Checking disk number:0

Checking disk number:1

Checking disk number:2

Checking if diskgroup is used by CSS

Generating configuration file..

Completed phase 1

Executing phase 2

Looking for ORCL:DATA1

Modifying the header

Looking for ORCL:DATA2

Modifying the header

Looking for ORCL:DATA3

Modifying the header

Completed phase 2

Terminating kgfd context 0x2af21517e0a0

If the above command fails, searching for disks, then we need to include the diskstring and then you need to use

  renamedg phase=both dgname=DATA newdgname=DG_PROD_DATA verbose=true asm_diskstring='discoverystring1','discoverystring2'


4) Finally, mount the renamed diskgroup and validate that it was mounted (on each node if this is a RAC configuration):
# asmcmd mount DG_PROD_DATA

# 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 32756 31828 244 15792 0 N DATA_OCR/

MOUNTED EXTERN N 512 4096 1048576 24567 14267 0 14267 0 N DG_PROD_DATA/
MOUNTED EXTERN N 512 4096 1048576 16378 10134 0 10134 0 N LOBDATA/



<renamedg tool cannot rename the associated ASM disk(s) name(s). >>>

IMPORTANT : With renamedg the diskgroup name changes. As the ASM File names ( like datafiles / controlfiles etc ), include the diskgroups name, you need to take care ( update pfile or rename datafiles ) from the RDBMS instance, after renamedg.

===================================================================

Rename Diskgroup having OCR , Vote File , ASM SPILE



GOAL

Consider a 11.2 Grid Infrastructure with CLUSTER setup having OCR ,Vote File and ASM SPFILE on a diskgroup. Under certain circumstances you may wish to rename that diskgroup.

"renamedg" utility can be used to rename of the diskgroup when the diskgroup is dismounted.
 But since the diskgroup contains OCR and Vote File we need to use an intermediate diskgroup for storing OCR and Vote File temporarily while renaming the actual diskgroup.

SOLUTION

Basic Steps to rename the diskgroup :

1) Create a temporary diskgroup (TEMP) with suitable redundancy for OCR and Vote files.

2) Move OCR and Vote file from to .

3) Change ASM SPFILE location from to diskgroup.

4) Restart CRS in all Nodes to Startup CRS using New SPFILE from diskgroup.

5) Dismount the OLD diskgroup in all cluster nodes that is not used by CRS.

6) Rename OLD diskgroup to NEW diskgroup

7) Mount the renamed diskgroup .

8) Move OCR and Vote file from TEMP diskgroup to renamed diskgroup.

9) Change ASM SPFILE location from to renamed diskgroup.

10) Restart CRS in all nodes to startup CRS using new SPFILE from renamed diskgroup.

11) Drop the intermediate diskgroup TEMP.

12) Need to remove the diskgroup resources TEMP and from Oracle Clusterware .

13) Ensure ALL cluster resources are started successfully .

 Below assumptions are made :
-> Name of Temporary diskgroup is TEMP.
-> OCR,Voting Disks and ASM SPFILE are originally stored in a diskgroup DATA.
-> Diskgroup DATA should be renamed to CRS.
-> $ORACLE_HOME points to GRID Home.
-> Cluster is up and running in all nodes of RAC.



Detailed steps with commands to rename the diskgroup :
1) Create a temporary diskgroup :

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:

create diskgroup TEMP normal redundancy disk , ,
attribute 'compatible.rdbms'='11.2.0.0', 'compatible.asm'='11.2.0.0', 'au_size'=;

Sample Command Output:

SQL> create diskgroup TEMP normal redundancy disk 'ORCL:DISK4' ,'ORCL:DISK5' ,'ORCL:DATA4' 
attribute 'compatible.rdbms'='11.2.0.0', 'compatible.asm'='11.2.0.0', 'au_size'='4M';

Diskgroup created.



2) Move OCR and Vote file from to :

$ORACLE_HOME/bin/bin/ocrconfig -add +TEMP
$ORACLE_HOME/bin/bin/ocrconfig -delete +DATA
$ORACLE_HOME/bin/crsctl replace votedisk +TEMP



Sample Command Output:

[root@test ~]# $ORACLE_HOME/bin/ocrconfig -add +TEMP
[root@test ~]# date
Mon Jul 4 21:10:16 IST 2011

[root@test ~]# $ORACLE_HOME/bin/ocrconfig -delete +DATA
[root@test ~]# date
Mon Jul 4 21:10:40 IST 2011


[root@test ~]# $ORACLE_HOME/bin/crsctl replace votedisk +TEMP
Successful addition of voting disk 9d351cfdbef64facbfe2d1519880ef33.
Successful addition of voting disk 302c23b19e864f92bfa68eda9045e5cc.
Successful addition of voting disk 6eeca4920acb4f8fbf6ec5a4e2b8ea7b.
Successful deletion of voting disk 32f7d65cf17d4fa3bf2932998251635f.
Successful deletion of voting disk 10c31fb0891d4f5abfb38ef34cd49f4d.
Successful deletion of voting disk 7d6f7d6480554f01bfc2621a3adb8f5f.
Successfully replaced voting disk group with +TEMP.
CRS-4266: Voting file(s) successfully replaced

[root@test ~]# date
Mon Jul 4 21:11:28 IST 2011


[root@test ~]# $ORACLE_HOME/bin/crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 9d351cfdbef64facbfe2d1519880ef33 (ORCL:DISK4) [TEMP]
2. ONLINE 302c23b19e864f92bfa68eda9045e5cc (ORCL:DISK5) [TEMP]
3. ONLINE 6eeca4920acb4f8fbf6ec5a4e2b8ea7b (ORCL:DATA4) [TEMP]
Located 3 voting disk(s).
[root@test ~]#


[root@test ~]# $ORACLE_HOME/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2804
Available space (kbytes) : 259316
ID : 1778064925
Device/File Name : +TEMP
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



3) Change ASM SPFILE location from to diskgroup.

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:

create pfile='/tmp/init/init' from spfile;
create spfile='+TEMP' from pfile='/tmp/init/init';

Now GPNPTOOL will get updated with new ASM SPFILE location.

That can be verified by below command :
$ORACLE_HOME/bin/gpnptool get



4) Restart CRS on all nodes to startup CRS using new SPFILE from TEMP diskgroup :

crsctl stop crs
crsctl start crs



5) Dismount the OLD Diskgroup on all cluster nodes:

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:

SQL>alter diskgroup data dismount;

Sample Command Output:
SQL> alter diskgroup data dismount;
Diskgroup altered.

SQL> !date
Mon Jul 4 21:38:28 IST 2011


6) Rename OLD diskgroup to NEW diskgroup name :

renamedg phase=both dgname=DATA newdgname=CRS verbose=true 

Sample Command Output:
[grid@test ~]$ renamedg phase=both dgname=DATA newdgname=CRS asm_diskstring='' verbose=true

Parsing parameters..
Parameters in effect:
Old DG name : DATA
New DG name : CRS
Phases :
Phase 1
Phase 2
Discovery str : (null)
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=DATA newdgname=CRS verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK1 with disk number:0 and timestamp (32955539 -2120261632)
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK2 with disk number:1 and timestamp (32955539 -2120261632)
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK3 with disk number:2 and timestamp (32955539 -2120261632)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK1 with disk number:0 and timestamp (32955539 -2120261632)
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK2 with disk number:1 and timestamp (32955539 -2120261632)
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK3 with disk number:2 and timestamp (32955539 -2120261632)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:0
Checking disk number:1
Checking disk number:2
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for ORCL:DISK1
Modifying the header
Looking for ORCL:DISK2
Modifying the header
Looking for ORCL:DISK3
Modifying the header
Completed phase 2
Terminating kgfd context 0xb7ee8050
[grid@test ~]$



SQL> set line 1000
set pages 599
col path format a30
select name,path,group_number,header_status,total_mb,free_mb from v$asm_disk;
select name,state,usable_file_mb,total_mb,free_mb,required_mirror_free_mb from v$asm_diskgroup;

NAME PATH GROUP_NUMBER HEADER_STATU TOTAL_MB FREE_MB
------------------------------ ------------------------------ ------------ ------------ ---------- ----------
ORCL:DISK1 0 MEMBER 0 0
ORCL:DISK2 0 MEMBER 0 0
ORCL:DISK3 0 MEMBER 0 0
ORCL:DISK6 0 MEMBER 0 0
DATA1 ORCL:DATA1 2 MEMBER 977 642
DATA2 ORCL:DATA2 2 MEMBER 977 642
DATA3 ORCL:DATA3 1 MEMBER 15109 9982
DATA4 ORCL:DATA4 3 MEMBER 252 76
DATA6 ORCL:DATA6 3 MEMBER 860 576
DISK4 ORCL:DISK4 3 MEMBER 668 376
DISK5 ORCL:DISK5 3 MEMBER 668 372

11 rows selected.

SQL>
NAME STATE USABLE_FILE_MB TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB
------------------------------ ----------- -------------- ---------- ---------- -----------------------
DATA1 MOUNTED 9982 15109 9982 0
FLASH MOUNTED 642 1954 1284 0
TEMP MOUNTED 552 2448 1400 296
CRS DISMOUNTED 0 0 0 0

7) Mount the renamed diskgroup on All the nodes:

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:

SQL>alter diskgroup CRS mount;

Sample Command Output:

SQL> alter diskgroup CRS mount;
Diskgroup altered.


SQL> select name,state,usable_file_mb,total_mb,free_mb,required_mirror_free_mb from v$asm_diskgroup;

NAME STATE USABLE_FILE_MB TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB
------------------------------ ----------- -------------- ---------- ---------- -----------------------
DATA1 MOUNTED 9982 15109 9982 0
FLASH MOUNTED 642 1954 1284 0
TEMP MOUNTED 552 2448 1400 296
CRS MOUNTED 1196 3596 2644 252

SQL> !date
Mon Jul 4 21:52:05 IST 2011

8) Move OCR and Vote file from TEMP Diskgroup to Renamed Diskgroup :

$ORACLE_HOME/bin/ocrconfig -add +CRS
$ORACLE_HOME/bin/ocrconfig -delete +TEMP
$ORACLE_HOME/bin/crsctl replace votedisk +CRS

Sample Command Output:

[root@test ~]# $ORACLE_HOME/bin/ocrconfig -add +CRS
[root@test ~]# $ORACLE_HOME/bin/ocrconfig -delete +TEMP
[root@test ~]# $ORACLE_HOME/bin/crsctl replace votedisk +CRS
Successful addition of voting disk ae0f06430e724fb7bf3757a7cdf8a101.
Successful addition of voting disk 1b355413f5904f5abff181938191ed97.
Successful addition of voting disk a7f75c9872ac4f6fbf77bbcb10ea17a6.
Successful deletion of voting disk 9d351cfdbef64facbfe2d1519880ef33.
Successful deletion of voting disk 302c23b19e864f92bfa68eda9045e5cc.
Successful deletion of voting disk 6eeca4920acb4f8fbf6ec5a4e2b8ea7b.
Successfully replaced voting disk group with +CRS.
CRS-4266: Voting file(s) successfully replaced
[root@test ~]# date
Mon Jul 4 21:55:48 IST 2011

9) Change ASM SPFILE location from to Renamed Diskgroup:

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:

create spfile='+CRS' from pfile='/tmp/init/init';

Sample Command Output:

SQL> create spfile='+CRS' from pfile='/tmp/init/init';
File created.

SQL> !date
Mon Jul 4 21:56:56 IST 2011

10) Restart CRS on all nodes to Startup CRS using new SPFILE from renamed diskgroup :

crsctl stop crs
crsctl start crs

11) Drop the Intermediate Diskgroup TEMP :

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands::

SQL>drop diskgroup temp including contents;
NOTE: Diskgroup TEMP must be mounted in order to be able to drop it.You need to mount it (if it is not already mounted at CRS startup) and then run "drop diskgroup.."


12) Need to Remove the Diskgroup Resources TEMP and from Oracle Clusterware :

srvctl remove diskgroup -g data
srvctl remove diskgroup -g TEMP

Sample Command Output:

[root@test ~]# $ORACLE_HOME/bin/srvctl remove diskgroup -g data
[root@test ~]# $ORACLE_HOME/bin/srvctl remove diskgroup -g TEMP
[root@test ~]# date
NOTE: Normally diskgroup TEMP as resource should be removed by "drop diskgroup.." command, hence you need to run above command only if the resource is not already dropped.
In case of DATA diskgroup resource you need to explicitly remove it using srvctl command as the diskgroup was just renamed not dropped.

13) Ensure ALL Cluster resources are started successfully using below sample commands :

$ORACLE_HOME/bin/crsctl stat res -init -t
$ORACLE_HOME/bin/crsctl check cluster -all
$ORACLE_HOME/bin/crsctl stat res -t

=========================================================================================

How to change database to use a new diskgroup after diskgroup rename

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.
***Checked for relevance on 22-Apr-2013***

GOAL

Customer may change ASM diskgroup names. This note is for steps on how to change database to use a new diskgroup after diskgroup rename using renamedg.


SOLUTION


1. Find init file for the database.

$ srvctl config database -d -a

a) If using a spfile in the renamed diskgroup, then modify it to use the new diskgroup name in the spfile path.
If the DB has a dependency with the renamed diskgroup before, the dependency should be changed, too.

$ srvctl modify database -d -p -a ""

b) If using a filesystem pfile, modify the content directly to use new diskgroup name. The file should be under $ORACLE_HOME/dbs directory.

c) If using a filesystem spfile or a raw device spfile, create a pfile from spfile, modify the pfile to use new diskgroup name, then create a new spfile from pfile.
The filesystem spfile should be under $ORACLE_HOME/dbs directory; while the raw device spfile is usually like /dev/raw/raw1 or similar.

Some parameters to check in the init file:
-- control_files
-- db_create_file_dest

Repeat these steps on all remote nodes if the pfile/spfile is local to each node.


2. Once init file is correct and has correct control file location, the database can be started with mount mode.

SQL> startup mount;


3. Once database is mounted, backup the control file to a trace file. This will create a trace file under trace directory.

SQL> alter database backup controlfile to trace;


4. Find all the files including datafiles, redo logs, and temp files in the trace file generated in step #3. Then create a rename command for each file using the old diskgroup name.
For example:

alter database rename file '+//datafile/system.257.718138103' to '+//datafile/system.257.718138103';


5. Run the rename commands for all files in step #4.


6. If using block change tracking, run the following commands to use the new diskgroup name.

SQL> alter database disable block change tracking;
SQL> alter database enable block change tracking using file '+';


7. Then start DB with open mode.

SQL> alter database open;


8. Run any necessary queries and tests to confirm the change was successful.

==============================================================


Comments