Oracle rename Asm diskgroup with DB files

 


There are 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.


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}]


1) Check Current configuration for database attached to diskgroup 

srvctl config database -d <DB_NAME>
select file_name from  v$datafile ; 


2) Stop/dismount diskgroup 

srvctl stop database -d <DB_NAME>
srvctl status diskgroup -g reco
srvctl stop diskgroup -g recoc1   


3) Rename diskgroup 

renamedg phase=both dgname=RECOC1 newdgname=RECO verbose=true keep_voting_files=true 

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=<OLD_DG_NAME> newdgname=<NEW_DG_NAME> verbose=true asm_diskstring='<discoverystring1>','<discoverystring2>


SQL> alter diskgroup RECO mount restricted;
SQL> alter diskgroup RECO rename disks all ;

srvctl start diskgroup -g reco   
srvctl status diskgroup -g reco


4) Modify spfile and password file location for database to point to new asm diskgroup 

srvctl modify database -d <db_name> -p <spfile_path_with_new_diskgroup> -a "<diskgroup_list>"


5)  Rename datafile location  in mount stage 

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

select 'alter database rename file '''||member||''' to '' +NEWDG'||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


6)   Drop and recreate block change tracking file 

7) Change  Archive location / Fra Location / Snapshot Controlfile location  that is attached to this diskgroup 


References : 

How To Rename A Diskgroup On ASM 11gR2? (Doc ID 948040.1)
How to Change Database to Use a New Diskgroup After Diskgroup Rename (Doc ID 1359625.1)

Comments

Popular posts from this blog

How To Purge Optimizer Statistics Advisor Old Records From 12.2 Onwards (Doc ID 2660128.1)

Oracle session snapper

Oracle Materialized View In-Depth and Materialized View refresh issues in 19c