Migrate / Convert Oracle Database from Non-ASM to ASM Using RMAN

The following method shows how a Non-ASM database can be migrated to ASM using RMAN: Modify the parameter file of the target database as follows: - ALTER DATABASE DISABLE BLOCK CHANGE TRACKING; - Set the DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n parameters to the relevant ASM disk groups. - Remove the CONTROL_FILES parameter from the spfile so the control files will be moved to the DB_CREATE_* destination and the spfile gets updated automatically. ALTER SYSTEM SET db_create_file_dest='+DATA' SCOPE=SPFILE; ALTER SYSTEM SET db_recovery_file_dest='+FLASH' SCOPE=SPFILE; ALTER SYSTEM SET control_files='+DATA' SCOPE=SPFILE; - If you are using a pfile these parameter must be set to the appropriate ASM files or aliases. Shutdown the database SQL> SHUTDOWN IMMEDIATE Start the database in nomount mode. Make sure the Environment is set properly RMAN> CONNECT TARGET / RMAN> STARTUP NOMOUNT Restore the controlfile into the new location from the old location. RMAN> RESTORE CONTROLFILE FROM 'old_control_file_name'; Mount the database. RMAN> ALTER DATABASE MOUNT; Copy the database into the ASM disk group. RMAN> BACKUP AS COPY DATABASE FORMAT '+DATA'; Switch all datafile to the new ASM location. RMAN> SWITCH DATABASE TO COPY; Recover the database. RMAN> RECOVER DATABASE; Using SQL*Plus to migrate flashback logs, change tracking file and temp files: SQL> ALTER DATABASE FLASHBACK OFF; SQL> ALTER DATABASE FLASHBACK ON; SQL> ALTER DATABASE OPEN; Create New temporary tablespace in ASM disk group and Drop the old ones.

SQL> SHUTDOWN IMMEDIATE rac1-> rman Recovery Manager: Release 10. SQL> System altered.ctl'.768333209 Finished restore at 27-NOV-11 RMAN> . Create new redo logs in ASM Diskgroup and delete the old ones.0 . SQL> DROP TABLESPACE ‘old_temporary_tablespace’ including contents and datafiles. Starting restore at 27-NOV-11 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=DISK channel ORA_DISK_1: copied control file copy output filename=+DATA/stagedb/controlfile/backup. SQL> System altered. ALTER SYSTEM SET db_recovery_file_dest='+FLASH' SCOPE=SPFILE.1. 2005. SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING. All rights reserved.SQL> CREATE TEMPORARY TABLESPACE temp1 TEMPFILE ‘+DATA’. RMAN> RESTORE CONTROLFILE FROM '<original location>/control02. ALTER SYSTEM SET control_files='+DATA' System altered.0. EXAMPLE : SQL> ALTER SYSTEM SET db_create_file_dest='+DATA' SCOPE=SPFILE.Production on Sun Nov 27 17:33:16 2011 Copyright (c) 1982.267.2. RMAN> connect target / connected to target database (not started) RMAN> startup nomount. Oracle.

dbf output filename=+DATA/stagedb/datafile/users.269.269.dbf output filename=+DATA/stagedb/datafile/sysaux.768333589" .270.768333651 tag=TAG20111127T175818 recid=4 stamp=768333653 channel ORA_DISK_1: datafile copy complete.768333503" datafile 2 switched to datafile copy "+DATA/stagedb/datafile/undotbs1.768333589 tag=TAG20111127T175818 recid=2 stamp=768333626 channel ORA_DISK_1: datafile copy complete.273. elapsed time: 00:01:26 channel ORA_DISK_1: starting datafile copy input datafile fno=00003 name=/u01/app/oracle/oradata/stagedb/sysaux01.271.768333659 tag=TAG20111127T175818 recid=5 stamp=768333660 channel ORA_DISK_1: datafile copy complete.dbf output filename=+DATA/stagedb/datafile/undotbs1.dbf output filename=+DATA/stagedb/datafile/system.268. Starting backup at 27-NOV-11 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=DISK channel ORA_DISK_1: starting datafile copy input datafile fno=00001 name=/u01/app/oracle/oradata/stagedb/system01.268. elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile fno=00004 name=/u01/app/oracle/oradata/stagedb/users01.270.768333635 tag=TAG20111127T175818 recid=3 stamp=768333641 channel ORA_DISK_1: datafile copy complete.768333663 tag=TAG20111127T175818 comment=NONE channel ORA_DISK_1: backup set complete.RMAN> BACKUP AS COPY DATABASE FORMAT '+DATA'. datafile 1 switched to datafile copy "+DATA/stagedb/datafile/system. elapsed time: 00:00:03 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current SPFILE in backupset channel ORA_DISK_1: starting piece 1 at 27-NOV-11 channel ORA_DISK_1: finished piece 1 at 27-NOV-11 piece handle=+DATA/stagedb/backupset/2011_11_27/nnsnf0_tag20111127t17581 8_0.272. elapsed time: 00:00:05 Finished backup at 27-NOV-11 RMAN> RMAN> SWITCH DATABASE TO COPY. elapsed time: 00:00:08 channel ORA_DISK_1: starting datafile copy copying current control file output filename=+DATA/stagedb/controlfile/backup.768333635" datafile 3 switched to datafile copy "+DATA/stagedb/datafile/sysaux.768333503 tag=TAG20111127T175818 recid=1 stamp=768333584 channel ORA_DISK_1: datafile copy complete. elapsed time: 00:00:46 channel ORA_DISK_1: starting datafile copy input datafile fno=00002 name=/u01/app/oracle/oradata/stagedb/undotbs01.

All rights reserved.1. 2005.271. SQL> select tablespace_name from dba_tablespaces.0.1. elapsed time: 00:00:00 Finished recover at 27-NOV-11 RMAN> exit Recovery Manager complete. OLAP and Data Mining options SQL> select flashback_on from v$database. Starting recover at 27-NOV-11 using channel ORA_DISK_1 starting media recovery media recovery complete.0. TABLESPACE_NAME -----------------------------SYSTEM UNDOTBS1 SYSAUX TEMP USERS SQL> create temporary tablespace temp1 tempfile '+DATA'. Tablespace created. rac1-> sqlplus SQL*Plus: Release 10. Enter user-name: / as sysdba Connected to: Oracle Database 10g Enterprise Edition Release 10.0 .Production With the Partitioning. . Database altered.0 .2. Oracle.2.datafile 4 switched to datafile copy "+DATA/stagedb/datafile/users.Production on Sun Nov 27 18:04:35 2011 Copyright (c) 1982. FLASHBACK_ON -----------------NO SQL> SQL> alter database open.768333651" RMAN> RECOVER DATABASE.

status from v$log.Need to make sure that the redo logs groups that are dropped are not CURRENT ot ACTIVE SQL> select group#. SQL> alter database add logfile group 6 '+DATA'. alter system switch logfile.log NO 2 ONLINE /u01/app/oracle/oradata/stagedb/redo02.------MEMBER -------------------------------------------------------------------------------IS_ --3 ONLINE /u01/app/oracle/oradata/stagedb/redo03. GROUP# STATUS ---------. Database altered. Database altered. Drop the old redo log files .log NO SQL> alter database add logfile group 4 '+DATA'. GROUP# STATUS TYPE ---------.---------------1 INACTIVE 2 INACTIVE . Database altered.log NO 1 ONLINE /u01/app/oracle/oradata/stagedb/redo01.------. SQL> DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES. SQL> select * from v$logfile.SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP1. SQL> alter database add logfile group 5 '+DATA'. Tablespace dropped.

dbalounge. GROUP# STATUS ---------.com http://www. SQL> select group#. SQL> alter database drop logfile group 3. SQL> alter database drop logfile group 1. Database altered. Database altered. SQL> alter database drop logfile group 2. status from v$log.com .---------------4 CURRENT 5 UNUSED 6 UNUSED Hemant Fulfagar Oracle Administration Architect hemant@dbalounge.3 4 5 6 INACTIVE CURRENT UNUSED UNUSED 6 rows selected. Database altered.