If you are considering migrating to ASM, here’s a simple piece of code to restore the database into ASM. You must take a backup of the database using RMAN. First, you would restore the controlfile and then proceed to restore the database to the +Data diskgroup for this particular example. This script simply generates an RMAN restore script to be executed after the restore of the control file from backup.

set echo off ver off feed off pages 0 head off lines 1022 trims on
spool /tmp/restore_database.sql
prompt run
prompt {
prompt allocate channel d1 type disk;;
prompt allocate channel d2 type disk;;
prompt allocate channel d3 type disk;;
prompt allocate channel d4 type disk;;
select 'set newname for datafile '||file#||' to '||chr(39)||'+DATA'||chr(39)||';'
from v$datafile;
prompt restore database;;
prompt switch datafile all;;
prompt release channel d1;;
prompt release channel d2;;
prompt release channel d3;;
prompt release channel d4;;
prompt }
spool off

You will also need to move redo log groups from the file system to ASM. You can create additional redo log groups in ASM and drop the old ones from the file system.

Posted by Charles Kim, Oracle ACE Director

Posted in ASM