Environment:
sys@ORCL> select * from v$version where rownum=1;BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prodsys@ORCL> !uname -aLinux localhost.localdomain 2.6.18-308.el5xen #1 SMP Fri Jan 27 17:59:00 EST 2012 i686 i686 i386 GNU/Linux
① Planning
+ DG1: used to store data files, control files, and online logs
+ Dg2: used to store online logs
+ Recovery: used for recovery area
idle> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB------------ ---------- --------------------------------- ---------- ---------- 1 DG1 MOUNTED 3072 3016 2 DG2 MOUNTED 768 718 3 RECOVERY MOUNTED 2304 2250
② Modify RDBMS Parameters
idle> alter system set db_recovery_file_dest='+RECOVERY' scope=both;System altered.idle> alter system set db_create_file_dest='+DG1' scope=both;System altered.idle> alter system set db_create_online_log_dest_1='+DG1' scope=both;System altered.idle> alter system set db_create_online_log_dest_2='+DG2' scope=both;System altered.
③ Log File migration
idle> alter database add logfile group 4 ('+DG1','+DG2') size 80m;Database altered.idle> alter database add logfile group 5 ('+DG1','+DG2') size 80m;Database altered.idle> alter database add logfile group 6 ('+DG1','+DG2') size 80m;Database altered.
If the status of the log group is inactive, the deletion can be successful.
idle> alter system checkpoint;idle> alter database drop logfile group 1;Database altered.idle> alter database drop logfile group 2;Database altered.idle> alter database drop logfile group 3;Database altered.idle> select group#,status from v$log; GROUP# STATUS---------- ---------------- 4 INACTIVE 5 CURRENT 6 UNUSEDidle> select member from v$logfile;MEMBER-----------------------------------------------------------------+DG1/orcl/onlinelog/group_4.256.798634749+DG2/orcl/onlinelog/group_4.256.798634753+DG1/orcl/onlinelog/group_5.259.798634795+DG2/orcl/onlinelog/group_5.259.798634801+DG1/orcl/onlinelog/group_6.260.798634825+DG2/orcl/onlinelog/group_6.260.798634829
④ Temporary file migration
idle> select file_name,tablespace_name from dba_temp_files;FILE_NAME TABLESPACE_NAME------------------------------------------------------- ------------------------------/u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_8050j3 TEMP4j_.tmpidle> alter tablespace temp add tempfile '+DG1';Tablespace altered.idle> select file_name,tablespace_name from dba_temp_files;FILE_NAME TABLESPACE_NAME------------------------------------------------------- ------------------------------+DG1/orcl/tempfile/temp.258.798635383 TEMP/u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_8050j3 TEMP4j_.tmpidle> alter tablespace temp drop tempfile '/u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_8050j34j_.tmp';Tablespace altered.idle> select file_name,tablespace_name from dba_temp_files;FILE_NAME TABLESPACE_NAME------------------------------------------------------- ------------------------------+DG1/orcl/tempfile/temp.258.798635383 TEMP
⑤ Migration control files and data files
During the entire migration process, only this step needs to be disabled and started for the database instance.
idle> show parameter control_filesNAME TYPE VALUE------------------------------------ ----------- ------------------------------control_files string /u01/app/oracle/oradata/ORCL/c ontrolfile/o1_mf_8050hgfp_.ctl , /u01/app/oracle/flash_recove ry_area/ORCL/controlfile/o1_mf _8050hgqh_.ctlidle> alter database backup controlfile to '/home/oracle/asmctl02.ctl';Database altered.idle> alter system set control_files='+DG1/ORCL/CONTROLFILE/control01','+DG2/ORCL/CONTROLFILE/control02' scope=spfile;System altered.idle> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.RMAN> startup nomount;Oracle instance startedTotal System Global Area 419430400 bytesFixed Size 1219760 bytesVariable Size 146801488 bytesDatabase Buffers 268435456 bytesRedo Buffers 2973696 bytesRMAN> restore controlfile from '/home/oracle/asmctl02.ctl';Starting restore at 06-NOV-12using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=156 devtype=DISKchannel ORA_DISK_1: copied control file copyoutput filename=+DG1/orcl/controlfile/control01output filename=+DG2/orcl/controlfile/control02Finished restore at 06-NOV-12RMAN> alter database mount;database mountedreleased channel: ORA_DISK_1RMAN> backup as copy database format '+DG1';Starting backup at 06-NOV-12using channel ORA_DISK_1channel ORA_DISK_1: starting datafile copyinput datafile fno=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_8050fk2z_.dbfoutput filename=+DG1/orcl/datafile/system.261.798636159 tag=TAG20121106T112238 recid=2 stamp=798636197channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45channel ORA_DISK_1: starting datafile copyinput datafile fno=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_8050fk3w_.dbfoutput filename=+DG1/orcl/datafile/sysaux.262.798636203 tag=TAG20121106T112238 recid=3 stamp=798636232channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35channel ORA_DISK_1: starting datafile copyinput datafile fno=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_8050jhm7_.dbfoutput filename=+DG1/orcl/datafile/example.263.798636239 tag=TAG20121106T112238 recid=4 stamp=798636252channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15channel ORA_DISK_1: starting datafile copyinput datafile fno=00002 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_8050fkc6_.dbfoutput filename=+DG1/orcl/datafile/undotbs1.264.798636255 tag=TAG20121106T112238 recid=5 stamp=798636257channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08channel ORA_DISK_1: starting datafile copyinput datafile fno=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_8050fkdh_.dbfoutput filename=+DG1/orcl/datafile/users.265.798636261 tag=TAG20121106T112238 recid=6 stamp=798636261channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01Finished backup at 06-NOV-12RMAN-06497: WARNING: control file is not current, control file autobackup skippedRMAN> recover database;Starting recover at 06-NOV-12using channel ORA_DISK_1starting media recoveryarchive log thread 1 sequence 16 is already on disk as file +DG1/orcl/onlinelog/group_5.259.798634795archive log filename=+DG1/orcl/onlinelog/group_5.259.798634795 thread=1 sequence=16media recovery complete, elapsed time: 00:00:02Finished recover at 06-NOV-12RMAN> switch database to copy;datafile 1 switched to datafile copy "+DG1/orcl/datafile/system.261.798636159"datafile 2 switched to datafile copy "+DG1/orcl/datafile/undotbs1.264.798636255"datafile 3 switched to datafile copy "+DG1/orcl/datafile/sysaux.262.798636203"datafile 4 switched to datafile copy "+DG1/orcl/datafile/users.265.798636261"datafile 5 switched to datafile copy "+DG1/orcl/datafile/example.263.798636239"RMAN> alter database open resetlogs;database opened
⑥ Make sure all files have been migrated to ASM
sys@ORCL> select name,status from v$datafile;NAME STATUS-------------------------------------------------- -------+DG1/orcl/datafile/system.261.798636159 SYSTEM+DG1/orcl/datafile/undotbs1.264.798636255 ONLINE+DG1/orcl/datafile/sysaux.262.798636203 ONLINE+DG1/orcl/datafile/users.265.798636261 ONLINE+DG1/orcl/datafile/example.263.798636239 ONLINEsys@ORCL> select name from v$controlfile;NAME--------------------------------------------------+DG1/orcl/controlfile/control01+DG2/orcl/controlfile/control02sys@ORCL> select member from v$logfile;MEMBER----------------------------------------------------------------------------------------------------+DG1/orcl/onlinelog/group_4.256.798634749+DG2/orcl/onlinelog/group_4.256.798634753+DG1/orcl/onlinelog/group_5.259.798634795+DG2/orcl/onlinelog/group_5.259.798634801+DG1/orcl/onlinelog/group_6.260.798634825+DG2/orcl/onlinelog/group_6.260.7986348296 rows selected.sys@ORCL> select name,status from v$tempfile;NAME STATUS-------------------------------------------------- -------+DG1/orcl/tempfile/temp.258.798635383 ONLINE
7. Final verification
idle> startupASM instance startedTotal System Global Area 83886080 bytesFixed Size 1217836 bytesVariable Size 57502420 bytesASM Cache 25165824 bytesASM diskgroups mountedsys@ORCL> startupORACLE instance started.Total System Global Area 419430400 bytesFixed Size 1219760 bytesVariable Size 150995792 bytesDatabase Buffers 264241152 bytesRedo Buffers 2973696 bytesDatabase mounted.Database opened.ASMCMD> lsctDB_Name Status Software_Version Compatible_version Instance_Nameorcl CONNECTED 10.2.0.1.0 10.2.0.1.0 orclorcl CONNECTED 10.2.0.1.0 10.2.0.1.0 orcl
Summary:
This migration is improved compared to the previous one:
(1) Two more disk groups are added, and fault guarantee is added. However, due to space, external ASM is selected.
(2) No spfile migration is performed.
(3) The control file is also mirrored in multiple ways: + DG1 and + dg2
Good luck
By think