Old disk group name   :      PROD

New disk group name :       NEWDG

 Check the databases are located in the Disk group

  • srvctl config database -d clouddb

Create a backup of spfile

 create pfile=’/home/oracle/initclouddb.ora’ from spfile;

Stop the databases running on PROD diskgroup we are going to rename. 

  • srvctl stop database -d clouddb
  • srvctl status database -d clouddb

Check the diskgroup status 

  • crsctl status resource

Disable the HAS component 

  • ./crsctl disable has

Dismount a disk group 

  • asmcmd umount PROD

Check the status of diskgroup

  • crsctl status resource

Rename the diskgroup using renamedg  utility

renamedg renames a disk group using a two-step process.

Phase one

This phase generates a configuration file to be used in phase two.

Phase two

This phase uses the configuration file to perform the renaming of the disk group.

  • renamedg phase=both dgname=PROD newdgname=NEWDG verbose=true config=/tmp/renamedg asm_diskstring=/dev/oracleasm/disks/PROD*

Mount the newly renamed diskgroup. 

  • asmcmd mount NEWDG

Check the Disk availability

  • asmcmd lsdg

Modify the parameter file which is using the old Disk group name.

Change the disk group for the database and start the database in mount stage 

  • srvctl modify database -d clouddb -a “NEWDG”
  • srvctl config database -d clouddb

Check the database files are located in old dg

We have to reallocate the files to new dg 

  • select name from v$datafile;

Change the datafile location

Script :

  • select ‘alter database rename file ”’||name||”’ to ”+NEWDG’||substr(name,instr(name,’/’,1,1))||”’;’ from V$DATAFILE; 

Commands :

  • alter database rename file ‘+PROD/CLOUDDB/DATAFILE/system.256.1064751943’ to ‘+NEWDG/CLOUDDB/DATAFILE/system.256.1064751943’; 
  • alter database rename file ‘+PROD/CLOUDDB/DATAFILE/sysaux.257.1064751989’ to ‘+NEWDG/CLOUDDB/DATAFILE/sysaux.257.1064751989’; 
  • alter database rename file ‘+PROD/CLOUDDB/DATAFILE/undotbs1.258.1064752013’ to ‘+NEWDG/CLOUDDB/DATAFILE/undotbs1.258.1064752013’; 
  • alter database rename file ‘+PROD/CLOUDDB/DATAFILE/users.259.1064752015’ to ‘+NEWDG/CLOUDDB/DATAFILE/users.259.1064752015’;

Now check the datafile location.

Check the logfile location pointing to old diskgroups

Change the logfile location to newdg

Script :

  • select ‘alter database rename file ”’||member||”’ to ”+NEWDG’||substr(member,instr(member,’/’,1,1))||”’;’ from V$logfile;

 commands : 

  • alter database rename file ‘+PROD/CLOUDDB/ONLINELOG/group_3.264.1064752063’ to ‘+NEWDG/CLOUDDB/ONLINELOG/group_3.264.1064752063’;
  • alter database rename file ‘+PROD/CLOUDDB/ONLINELOG/group_3.266.1064752069’ to ‘+NEWDG/CLOUDDB/ONLINELOG/group_3.266.1064752069’;
  • alter database rename file ‘+PROD/CLOUDDB/ONLINELOG/group_2.263.1064752063’ to ‘+NEWDG/CLOUDDB/ONLINELOG/group_2.263.1064752063’;
  • alter database rename file ‘+PROD/CLOUDDB/ONLINELOG/group_2.265.1064752069’ to ‘+NEWDG/CLOUDDB/ONLINELOG/group_2.265.1064752069’;
  • alter database rename file ‘+PROD/CLOUDDB/ONLINELOG/group_1.262.1064752063’ to ‘+NEWDG/CLOUDDB/ONLINELOG/group_1.262.1064752063’;
  • alter database rename file ‘+PROD/CLOUDDB/ONLINELOG/group_1.267.1064752069’ to ‘+NEWDG/CLOUDDB/ONLINELOG/group_1.267.1064752069’;

Change the temp file location to newdg 

  • select name from v$tempfile;
  • alter database rename file ‘+PROD/CLOUDDB/TEMPFILE/temp.268.1064752083’ to ‘+NEWDG/CLOUDDB/TEMPFILE/temp.268.1064752083’;

Create spfile in ASM Disk location from existing pfile.

Shut down the database.

Edit the pfile and set the spfile location in ASM to start the database in spfile

Change the spfile location in newdg 

  • srvctl modify database -d clouddb -spfile +NEWDG/clouddb/PARAMETERFILE/spfile.270.1064773001

Check all the locations are pointing to new renamed disk group locations 

  • srvctl config database -d clouddb

Rename the Disk name locatted inside the diskgroup 

set pagesize 200

set lines 299

col disk_name for a19

col path for a78

select a.NAME DISKGROUP_NAME , b.NAME DISK_NAME , b.path PATH from v$asm_diskgroup A , v$asm_disk b

where a.group_number=b.group_number and a.name=’NEWDG’;

Dismount and mount the diskgroup in mount restricted mode. 

  • alter diskgroup NEWDG dismount;
  • alter diskgroup NEWDG mount restricted;

Renamed all the disknames. 

  • ALTER DISKGROUP NEWDG RENAME DISK ‘PROD_0000’ TO ‘NEWDG_0000’;
  • ALTER DISKGROUP NEWDG RENAME DISK ‘PROD_0002’ TO ‘NEWDG_0002’;
  • ALTER DISKGROUP NEWDG RENAME DISK ‘RENAMED_PROD_0003’ TO ‘NEWDG_0003’;

Now the disk file name changed

set pagesize 200

set lines 299

col disk_name for a19

col path for a78

select a.NAME DISKGROUP_NAME , b.NAME DISK_NAME , b.path PATH from v$asm_diskgroup A , v$asm_disk b

where a.group_number=b.group_number and a.name=’NEWDG’;

Dismount the mount the diskgroup 

  • alter diskgroup NEWDG dismount;
  • alter diskgroup NEWDG mount;

Now start the database 

  • srvctl start database -d clouddb 
  • srvctl status database -d clouddb

Enable the has component 

  • ./crsctl enable has

Recommended Posts

Start typing and press Enter to search