CHANGE ASM DISK GROUP FROM NORMAL REDUNDANCY TO EXTERNAL REDUNDANCY
When the disk group was created with normal redundancy, the only way to change is is to drop the disk group and recreate a new one. Drop the existing diskgroup after database backup and create a new diskgroup with desired external redundancy.
Referred to this Metalink Note
How To Move The Database To Different Diskgroup (Change Diskgroup Redundancy) [ID 438580.1]
But since this note was for 10g to 11.1, it did not use asmca for configuring asm disk group. asmca is only available for 11R2. The steps were modified to use asmca and the init+ASM.ora was backup to /u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/asm_backup_pfile
But even it is not backed up and deleted, the asm will startup with a default set of init parameters which usually is the same as the backup.
1.Shutdown(immediate) the database and then startup mount. Take a valid RMAN backup of existing database as:
export ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=TESTDB
sqlplus / as sysdba
shutdown immediate;
startup mount;
rman target /
RMAN> backup device type disk format '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/%U' database ;
RMAN> backup device type disk format '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/%U' archivelog all;
2. Make copy of spfile to accessible location:
sqlplus / as sysdba
SQL> create pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/initTESTDB_PRIMARY.ora' from spfile;
SQL> alter database backup control file to '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/control.ctl';
3. Shutdown the RDBMS instance
SQL> shutdown immediate
4. Connect to ASM Instance and Drop the existing Diskgroups
asm alert log is here
/u01/app/oracle/diag/asm/+asm/+ASM/trace
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid
export ORACLE_SID=+ASM
sqlplus / as sysasm
backup asm spfile
create pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_asm_pfile/init+ASM.ora'
(The reason for the force is the spfile is in ASM and is in use)
SQL> alter diskgroup data dismount force
SQL> drop diskgroup data force including contents;
START X-SERVER ON CLIENT
cd $ORACLE_HOME/bin
./asmca
create a new diskgroup with external redundancy
OR
SQL> CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK 'ORCL:ASMDISK1' SIZE 307196M ,'ORCL:ASMDISK2' SIZE 307196M ,'ORCL:ASMDISK3' SIZE 307196M ATTRIBUTE 'compatible.asm'='11.2.0.0.0','compatible.rdbms'='10.1.0.0.0','au_size'='1M'
alter diskgroup mount
create spfile='+DATA' from memory;
or
create spfile='+DATA' from pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_asm_pfile/init+ASM.ora'
shutdown immediate
startup
7. Connect to the RDBMS instance and startup in nomount state using pfile
sqlplus / as sysdba
startup nomount pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/initTESTDB_PRIMARY.ora'
SQL> create spfile='+DATA' from pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/initTESTDB_PRIMARY.ora'
8. Now restore the control file and backup's using RMAN
RMAN > restore control file from '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/control.ctl';
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
unable to find archive log
archive log thread=1 sequence=4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/05/2007 18:24:32
RMAN-06054: media recovery requesting unknown log: thread 1 seq 4 lowscn
570820
While recovery it will give an error for archive log missing, this is expected we need to open the database with resetlogs as:
--for primary database
RMAN> alter database open resetlogs
-We also need to change Flash Recovery Area to newly created diskgroup location.
--ignore this since our db_recoery_file is on OS
SQL> alter system set db_recovery_file_dest='+DG1' scope=both;
SQL> alter database flashback off ;
--SQL> alter database flashback on ;
shutdown immediate;
startup mount;
rman target /
RMAN> backup device type disk format '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/%U' database ;
RMAN> backup device type disk format '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/%U' archivelog all;
2. Make copy of spfile to accessible location:
sqlplus / as sysdba
SQL> create pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/initTESTDB_PRIMARY.ora' from spfile;
SQL> alter database backup control file to '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/control.ctl';
3. Shutdown the RDBMS instance
SQL> shutdown immediate
4. Connect to ASM Instance and Drop the existing Diskgroups
asm alert log is here
/u01/app/oracle/diag/asm/+asm/+ASM/trace
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid
export ORACLE_SID=+ASM
sqlplus / as sysasm
backup asm spfile
create pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_asm_pfile/init+ASM.ora'
(The reason for the force is the spfile is in ASM and is in use)
SQL> alter diskgroup data dismount force
SQL> drop diskgroup data force including contents;
START X-SERVER ON CLIENT
cd $ORACLE_HOME/bin
./asmca
create a new diskgroup with external redundancy
OR
SQL> CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK 'ORCL:ASMDISK1' SIZE 307196M ,'ORCL:ASMDISK2' SIZE 307196M ,'ORCL:ASMDISK3' SIZE 307196M ATTRIBUTE 'compatible.asm'='11.2.0.0.0','compatible.rdbms'='10.1.0.0.0','au_size'='1M'
alter diskgroup mount
create spfile='+DATA' from memory;
or
create spfile='+DATA' from pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_asm_pfile/init+ASM.ora'
shutdown immediate
startup
7. Connect to the RDBMS instance and startup in nomount state using pfile
sqlplus / as sysdba
startup nomount pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/initTESTDB_PRIMARY.ora'
SQL> create spfile='+DATA' from pfile='/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/initTESTDB_PRIMARY.ora'
8. Now restore the control file and backup's using RMAN
RMAN > restore control file from '/u01/app/oracle/oradata/TESTDB/archivelog/TESTDB_PRIMARY/backup_redundency/control.ctl';
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
unable to find archive log
archive log thread=1 sequence=4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/05/2007 18:24:32
RMAN-06054: media recovery requesting unknown log: thread 1 seq 4 lowscn
570820
While recovery it will give an error for archive log missing, this is expected we need to open the database with resetlogs as:
--for primary database
RMAN> alter database open resetlogs
-We also need to change Flash Recovery Area to newly created diskgroup location.
--ignore this since our db_recoery_file is on OS
SQL> alter system set db_recovery_file_dest='+DG1' scope=both;
SQL> alter database flashback off ;
--SQL> alter database flashback on ;
. oraenv
+ASM
asmcmd
cd DATA/TESTDB_PIRMARY
ls -l PARAMETERFILE
PARAMETERFILE UNPROT COARSE JUL 28 11:00:00 Y spfile.256.757683869
PARAMETERFILE UNPROT COARSE JUL 28 13:00:00 Y spfile.352.757690657
ASMCMD>cd PARAMETERFILE
ASMCMD> rm spfile.256.757683869
ASMCMD>cd TESTDB_PRIMARY
mkalias +DATA/TESTDB_PRIMARY/PARAMETERFILE/spfile.352.757690657 spfileTESTDB_PRIMARY.ora
change the value inside file $ORACLE_HOME/dbs/initTESTDB.ora
from
SPFILE='+DATA/TESTDB/spfileTESTDB.ora'
to
SPFILE='+DATA/TESTDB_PIRMARY/spfileTESTDB_PRIMARY.ora'
shutdown immediate
startup
this time it uses correct spfile
clean up the files in asm in case there are extra copies
select * from dba_data_files
select * from v$tempfile
select * from v$logfile
select * from v$log
select * from v$standby_logfie
select * from v$controlfil
On primary
DGMGRL> edit database 'dbname' set property 'LogShipping'='ON';
SQL>alter system set log_archive_dest_state_2='ENABLE' scope=both
TO FIX THE spfile problem (it was in TESTDB folder, after recover, it ended up in TESTDB_PRIMARY folder)
This is what we did on PRIMARY
ASMCMD> ls -l parameterfile
Type Redund Striped Time Sys Name
PARAMETERFILE UNPROT COARSE JUL 27 14:00:00 Y spfile.256.757607617
ASMCMD> mkalias +DATA/TESTDB_PRIMARY/PARAMETERFILE/spfile.256.757607617 spfileTESTDB_PRIMARY.ora
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileTESTDB_PRIMARY.ora
ASMCMD>
change the value inside file $ORACLE_HOME/dbs/initTESTDB.ora
from
SPFILE='+DATA/TESTDB/spfileTESTDB.ora'
to
SPFILE='+DATA/TESTDB_PRIMARY/spfileTESTDB_PRIMARY.ora'
asmcmd
cd DATA/TESTDB_PIRMARY
ls -l PARAMETERFILE
PARAMETERFILE UNPROT COARSE JUL 28 11:00:00 Y spfile.256.757683869
PARAMETERFILE UNPROT COARSE JUL 28 13:00:00 Y spfile.352.757690657
ASMCMD>cd PARAMETERFILE
ASMCMD> rm spfile.256.757683869
ASMCMD>cd TESTDB_PRIMARY
mkalias +DATA/TESTDB_PRIMARY/PARAMETERFILE/spfile.352.757690657 spfileTESTDB_PRIMARY.ora
change the value inside file $ORACLE_HOME/dbs/initTESTDB.ora
from
SPFILE='+DATA/TESTDB/spfileTESTDB.ora'
to
SPFILE='+DATA/TESTDB_PIRMARY/spfileTESTDB_PRIMARY.ora'
shutdown immediate
startup
this time it uses correct spfile
clean up the files in asm in case there are extra copies
select * from dba_data_files
select * from v$tempfile
select * from v$logfile
select * from v$log
select * from v$standby_logfie
select * from v$controlfil
On primary
DGMGRL> edit database 'dbname' set property 'LogShipping'='ON';
SQL>alter system set log_archive_dest_state_2='ENABLE' scope=both
TO FIX THE spfile problem (it was in TESTDB folder, after recover, it ended up in TESTDB_PRIMARY folder)
This is what we did on PRIMARY
ASMCMD> ls -l parameterfile
Type Redund Striped Time Sys Name
PARAMETERFILE UNPROT COARSE JUL 27 14:00:00 Y spfile.256.757607617
ASMCMD> mkalias +DATA/TESTDB_PRIMARY/PARAMETERFILE/spfile.256.757607617 spfileTESTDB_PRIMARY.ora
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileTESTDB_PRIMARY.ora
ASMCMD>
change the value inside file $ORACLE_HOME/dbs/initTESTDB.ora
from
SPFILE='+DATA/TESTDB/spfileTESTDB.ora'
to
SPFILE='+DATA/TESTDB_PRIMARY/spfileTESTDB_PRIMARY.ora'
No comments:
Post a Comment