11gR2: Steps to Rename ASM Diskgroup with DB files

11gR2 introduced renamedg utility to rename diskgroups. I would discuss renaming a diskgroup on a Standalone Grid Infrastructure installation with Oracle Restart. Before you use the command, ensure that ASM diskgroup is dismounted.
Below is syntax for the command. You can refer to
11gR2 docs for details

renamedg
[phase={ one|two |both } ] dgname=diskgroup
newdgname=newdiskgroup [config=configfile]
[ asm_diskstring=discoverystring, discoverystring ... ]
[ clean={true|false} ] [ check={true|false} ]
[ confirm={true|false}] [ verbose={ true|false} ]
[ keep_voting_files={true|false}]

Basically we have two phases of using renamedg command, phase 1 generates a configuration file to be used by phase 2. In phase 2 actual renaming of diskgroup is done.

Note : – I have tried these steps in a Test environment and tried to cover the most components. But would recommend you  to cross verify the steps in a test environment before implementing in production environment

Lets get Started!!

1) Gather all the information for Oracle restart Configuration and DB parameters

Database Configuration

[oracle@db11g bin]$ srvctl config database -d test11r2
Database unique name: test11r2
Database name: test11r2
Oracle home: /u02/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/test11r2/spfiletest11r2.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA
Services:

ASM Information

[oracle@db11g bin]$ srvctl config asm
ASM home: /u02/app/oracle/product/11.2.0/grid
ASM listener: LISTENER
Spfile: +DATA/asm/asmparameterfile/registry.253.696489255
ASM diskgroup discovery string: /dev/oracleasm/disks/VOL*

[oracle@db11g bin]$ srvctl config listener
Name: LISTENER
Home: /u02/app/oracle/product/11.2.0/grid
End points: TCP:1521

Create Database parameter file

sql> create pfile='/tmp/param.txt' from spfile;

Oracle Restart configuration

Disable Oracle Restart so that it does not restart any component. ‘crsctl status resource’ can be used to check status of resources. As you can see I have stopped database but  ASM Diskgroup DATA is still mounted.

[oracle@db11g bin]$ crsctl disable has
[oracle@db11g bin]$ crsctl status resource
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on db11g

NAME=ora.FLASH_ARC.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on db11g

NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on db11g

NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on db11g

NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on db11g

NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=ONLINE
STATE=ONLINE on db11g

NAME=ora.test11r2.db
TYPE=ora.database.type
TARGET=OFFLINE
STATE=OFFLINE

2) We are renaming DATA diskgroup to DG.

[oracle@db11g bin]$ renamedg dgname=data newdgname=dg asm_diskstring='/dev/oracleasm/disks/VOL*' verbose=true
NOTE: No asm libraries found in the system

Parsing parameters..

Parameters in effect:

         Old DG name       : DATA
         New DG name          : DG
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        : /dev/oracleasm/disks/VOL*
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: dgname=data newdgname=dg asm_diskstring=/dev/oracleasm/disks/VOL* verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:/dev/oracleasm/disks/VOL*
Identified disk UFS:/dev/oracleasm/disks/VOL11 with disk number:2 and timestamp (32924744 398242816)
Identified disk UFS:/dev/oracleasm/disks/VOL12 with disk number:1 and timestamp (32924741 928525312)
Identified disk UFS:/dev/oracleasm/disks/VOL21 with disk number:0 and timestamp (32924744 362846208)
Identified disk UFS:/dev/oracleasm/disks/VOL22 with disk number:3 and timestamp (32924741 928525312)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/oracleasm/disks/VOL*
Identified disk UFS:/dev/oracleasm/disks/VOL11 with disk number:2 and timestamp (32924744 398242816)
Identified disk UFS:/dev/oracleasm/disks/VOL12 with disk number:1 and timestamp (32924741 928525312)
Identified disk UFS:/dev/oracleasm/disks/VOL21 with disk number:0 and timestamp (32924744 362846208)
Identified disk UFS:/dev/oracleasm/disks/VOL22 with disk number:3 and timestamp (32924741 928525312)
Checking if the diskgroup is mounted
Checking disk number:2
Checking disk number:1
Checking disk number:0
Checking disk number:3
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/oracleasm/disks/VOL11
Modifying the header
Looking for /dev/oracleasm/disks/VOL12
Modifying the header
Looking for /dev/oracleasm/disks/VOL21
Modifying the header
Looking for /dev/oracleasm/disks/VOL22
Modifying the header
Completed phase 2
Terminating kgfd context 0xb7e7a050

3) Modify ASM configuration to correct the spfile location

$srvctl modify asm -p +DG/asm/asmparameterfile/registry.253.696489255
$srvctl start asm

Connect to ASM instance and mount +DG diskgroup.

sqlplus "/ as sysasm"
sql> alter diskgroup DG mount;

At this moment, you will see additional ASM diskgroup resource ora.DG.dg in crsctl configuration. Remove the old ora.DATA.dg resource

oracle@db11g ~]$ crsctl delete resource ora.DATA.dg
CRS-2730: Resource 'ora.test11r2.db' depends on resource 'ora.DATA.dg'
CRS-4000: Command Delete failed, or completed with errors.

We get above error as the test11r2 database configuration states ora.DATA.dg as dependent resource. Use -f option to drop it by force. Or you can first modify the database configuration and drop the resource later.

[oracle@db11g ~]$ crsctl delete resource ora.DATA.dg -f

4) Startup Database.

To do that we need to modify parameter file as control_files parameter and other *_file_dest needs to be changed. Change all occurence of ‘+DATA’ to ‘+DG’. Open database in mount mode as we would have to rename database files and redo logs before opening databases

SQL> startup nomount pfile='/tmp/param.txt'
ORACLE instance started.

Total System Global Area  343154688 bytes
Fixed Size                  1336428 bytes
Variable Size             218106772 bytes
Database Buffers          117440512 bytes
Redo Buffers                6270976 bytes

SQL>alter database mount;

Use below command to get sql for renaming diskgroup information for datafiles/redo logs

 select 'alter database rename file '''||name||''' to ''<strong>+DG</strong>'||substr(name,instr(name,'/',1,1))||''';' from V$DATAFILE;

select 'alter database rename file '''||member||''' to ''<strong>+DG</strong>'||substr(member,instr(member,'/',1,1))||''';' from V$logfile;

V$RECOVER_FILE view can be used to check for any issues with datafiles not being available.
If everything is fine, you can open the database. You would have noticed that I have not done anything for Temp files. Checking alert log, we see that it is renamed automatically

 Re-creating tempfile +DATA/test11r2/tempfile/temp.268.696494395 as +DG/test11r2/tempfile/temp.272.704195475

Now we need to re-create spfile on ASM Diskgroup. Use following steps

$cd $ORACLE_HOME/dbs
$cat inittest11r2.ora
SPFILE='+DATA/test11r2/spfiletest11r2.ora'
$mv inittest11r2.ora inittest11r2.ora.new
$ cp /tmp/param.txt $ORACLE_HOME/dbs/inittest11r2.ora
$sqlplus "/ as sysdba"
SQL>create spfile='+DG/test11r2/spfiletest11r2.ora' from pfile;
exit
$mv inittest11r2.ora initest11r2.old

--- Modify inittest11r2.ora.new and change diskgroup to +DG---
$cat inittest11r2.ora.new
SPFILE='+DG/test11r2/spfiletest11r2.ora'
$mv inittest11r2.ora.new inittest11r2.ora

Now we need to modify Database configuration for Oracle Restart

[oracle@db11g ~]$ srvctl config database -d test11r2
Database unique name: test11r2
Database name: test11r2
Oracle home: /u02/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/test11r2/spfiletest11r2.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
PRCD-1012 : Failed to retrieve disk group list for database test11r2.
PRCR-1035 : Failed to look up CRS resource ora.DATA.dg for test11r2
PRCR-1001 : Resource ora.DATA.dg does not exist

As there is no DATA diskgroup available, it gives a error. If you notice initial output (before renaming diskgroup), there was entry for DATA Diskgroup. We also need to modify the entry for spfile.

[oracle@db11g ~]$ srvctl modify database -d test11r2 -p +DG/test11r2/spfiletest11r2.ora
[oracle@db11g ~]$ srvctl modify database -d test11r2 -a DG
[oracle@db11g dbs]$ srvctl config database -d test11r2
Database unique name: test11r2
Database name: test11r2
Oracle home: /u02/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
<strong>Spfile: +DG/test11r2/spfiletest11r2.ora</strong>
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
<strong>Disk Groups: DG</strong>
Services:

You can now shutdown database and use srvctl to start If you have not dropped ora.DATA.dg resource earlier (due to errors), you can drop it now without errors

 [oracle@db11g ~]$ crsctl delete resource ora.DATA.dg

You can now enable Oracle Restart

[oracle@db11g dbs]$ crsctl enable has
CRS-4622: Oracle High Availability Services autostart is enabled.

Phew!! This was quite a posting after long time!!

Tags: , , ,

12 thoughts on “11gR2: Steps to Rename ASM Diskgroup with DB files”

  • I would like to say thank you for writing this procedure which helps me to rename the diskgroup in my environment.

    I faced one problem while starting the database using srvctl.I dropped the old diskgroup names forcefully before modifying database configuration.
    I followed all the steps as per your procedure but while modifying database configuration for spfile it was giving me an error for old diskgroup then i updated diskgroup first and then spfile and it worked fine.

    (1)
    [oracle@db11g ~]$ srvctl modify database -d test11r2 -p +DG/test11r2/spfiletest11r2.ora

    (2)
    [oracle@db11g ~]$ srvctl modify database -d test11r2 -a DG

    I think we should first execute point no.2 and then 1.

    Thank You.
    Regards,
    Chirag Shah

  • Hi Amit,
    It’s very useful post indeed.

    I am planning to rename an ASM Diskgroup in a clustered environment with only one node now.

    Do I still need to disbale has (crsctl disable has) before starting the task?

    Thanks,
    Praveen Rao K.

  • Amit,
    When I tried the procedure, it failed for the first phase itself with below error:

    corptestdbr201:oracle:+ASM1> renamedg phase=one dgname=eesh_data newdgname=eeeps2_data config=’/tmp/eesh_data.conf’ verbose=true

    Parsing parameters..

    Parameters in effect:

    Old DG name : EESH_DATA
    New DG name : EEEPS2_DATA
    Phases :
    Phase 1
    Discovery str : (null)
    Clean : TRUE
    Raw only : TRUE
    renamedg operation: phase=one dgname=eesh_data newdgname=eeeps2_data config=/tmp/eesh_data.conf 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:ENRLPOWERAC with disk number:1 and timestamp (32960071 1915300864)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERAE with disk number:2 and timestamp (32965835 596190208)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERAU with disk number:0 and timestamp (32957293 1822227456)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDA with disk number:6 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDB with disk number:11 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDC with disk number:12 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDD with disk number:13 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDE with disk number:14 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDF with disk number:15 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDG with disk number:16 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDH with disk number:17 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDI with disk number:18 and timestamp (32955432 1721051136)
    Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ENRLPOWERDJ with disk number:19 and timestamp (32955432 1721051136)
    Not all disks of Diskgroup:EESH_DATA were discovered
    KFNDG-00403: file not found; arguments: [EESH_DATA]

    Terminating kgfd context 0x2b611ca780a0
    corptestdbr201:oracle:+ASM1>

    I have gone through http://askdba.org/weblog/2010/09/renaming-diskgroup-containing-voting-disk-ocr/ link. But the diskgroup I was trying to rename is not used to store OCR/Votedisk. But the DATABASE_COMPATIBILITY is shown as 10.1.0.0.0. Is this the main culprit for above error?

    Thanks,
    Praveen Rao K,.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.