Wednesday, February 19, 2014

Change Oracle ASM Diskgroup Redundancy

Summary

This process is utilized to change the redundancy of an existing diskgroup.  The example utilizes a RAC environment, but same process can be utilized for single instance environment with small variation.

Basic High Level Process

1.       Backup all databases that are on disk group(s) where redundancy needs changed.
2.       Remove disk group
3.       Create disk group at new redundancy level
4.       Restore databases

Process Detail Steps

1.  Shutdown database(s) to get all activity out of database

Example
srvctl stop database –d db1

. oraenv
db21
sqlplus / as sysdba
shutdown immediate


2. Start database instances (in RAC on node 1 and make sure all other instances of the database(s) are down) in restricted mode this will make sure no activity gets into database.

. oraenv
db1
sqlplus / as sysdba
startup mount

. oraenv
db21
sqlplus / as sysdba
startup mount



3. Take backup for each database on the diskgroup(s) where redundancy needs to be changed.

Example uses standard script to do level 0 hotbackup and backs up archive logs since database is in mount state no changes going on in DBs:
/u01/app/oracle/scripts/rman_hot_backup_rac.sh db1 0
/u01/app/oracle/scripts/rman_hot_backup_rac.sh db21 0


4. Shut database(s) down and re-start database instance(s) in nomount state, in this state we can do what we need with the disk groups and it be set to restore databases once the disk group(s) work is complete.

Example:
. oraenv
db1
sqlplus / as sysdba
shutdown immediate
startup nomount
exit

. oraenv
db21
sqlplus / as sysdba
shutdown immediate
startup nomount


5. Remove Existing diskgroup(s) that need redundancy changed, in a RAC environment make sure disk groups are dismounted from other ASM instances or other ASM instances are shutdown.

** On other nodes in ASM instance dismount the diskgroups
alter diskgroup data dismount ;
alter diskgroup reco dismount ;

Example
. oraenv
+ASM1
sqlplus / as sysasm
DROP DISKGROUP DATA INCLUDING CONTENTS;
DROP DISKGROUP RECO INCLUDING CONTENTS;


6. Recreate Disk Group(s) so that they are a different redundancy in this example we are doing external redundancy and au_size of 4M

Example:
. oraenv
+ASM1
sqlplus / as sysasm

CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK '/dev/sdd1' SIZE 255996M ,
'/dev/sde1' SIZE 255996M ,
'/dev/sdf1' SIZE 255996M ,
'/dev/sdg1' SIZE 255996M 
ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='4M' ;

CREATE DISKGROUP RECO EXTERNAL REDUNDANCY DISK '/dev/sdh1' SIZE 255996M ,
'/dev/sdi1' SIZE 255996M 
ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='4M' ;

7. Check that disk groups are the right size now and au_size and state is good.

select name, allocation_unit_size/1024/1024, total_mb, usable_file_mb, type, state
from v$asm_diskgroup ;


8. Restore database(s)

Example:
.oraenv
db1
rman target=/ catalog=/@rman

SET DBID 807730062;

run {
RESTORE CONTROLFILE FROM AUTOBACKUP ;
ALTER DATABASE MOUNT;
}

run {
restore database ;
recover database ;
}

.oraenv
db21
rman target=/ catalog=/@rman

SET DBID 807730062;

run {
RESTORE CONTROLFILE FROM AUTOBACKUP ;
ALTER DATABASE MOUNT;
}

run {
restore database ;
recover database ;
}


9. Open database(s) with resetlogs         

Example:
. oraenv
db1
sqlplus / as sysdba
alter database open resetlogs ;

. oraenv
db21
sqlplus / as sysdba
alter database open resetlogs ;


10. Check control file entries as after restore of control file then names change, then set the
initialization parameter to the new names

Example:
. oraenv
+ASM1
asmcmd
Check control files for the databases in their locations and update the init.ora or spfile

alter system set control_files='+RECO/db/controlfile/current.256.839933795', '+DATA/db/controlfile/current.257.839933795' scope=spfile sid='*' ;

vi init.ora file so just need to update init.ora file
*.control_files='+RECO/db2/controlfile/current.268.839934043', '+DATA/db2/controlfile/current.271.839934043'


11. bounce databases after restore and recover to ensure all is back to normal

Example:
. oraenv
db1
sqlplus / as sysdba
shutdown immediate
exit
srvctl start database -d db

. oraenv
db21
sqlplus / as sysdba
shutdown immediate
startup
exit


12. Take new level 0 hot backups of both databases.

Example:
/u01/app/oracle/scripts/rman_hotbackup_rac.sh db1 0 &
/u01/app/oracle/scripts/rman_hotbackup_rac.sh db21 0


ALL DONE!!

5 comments:

dba said...

Is it really possible to convert Redundancy of the Disk Group from High to Normal?
When the Disk Group contains Data Bases.MOS note-438580.1 says it is not possible to do that..

Mike Messina said...

You can change redundancy of a disk group, this will require database downtime as you have to backup and restore the database so disk group can be recreated the disk group is first dropped then recreated with new redundancy never know a limitation to drop and recreate a disk group then restore data onto a recreated disk group.

Backup database(s) is the first step.
Drop disk group (This removes the disk group Completely)
Create a new disk group at redundancy you want
restore database(s) back onto new diskgroup.

Anonymous said...

for example,i have only one diskgroup with external redundancy if removed the diskgroup then what will happen to asm instance

Mike Messina said...

For ASM you will always want a disk group with no disk groups kind of defeats the purpose, I would always in cases of ASM if I had 1 external redundancy disk group and I wanted to change to a NORMAL or HIGH redundancy disk group I would create new disk group move the files then remove the external redundancy disk group. I typically do not backup and recovery any longer when changing disk groups I create a new disk group and move the files to new disk group.

Nitesh Sharma said...

Amazing Blog. Thanks for providing such a good article, this article very useful for me and everyone, a lot of thanks. keep it up. i am also using a blog about Redundancy. Visit our website at About Redundancy