export ORACLE_SID=testdb
sqlplus '/as sysdba'
create pfile from spfile;
exit
cp inittestdb.ora inittestdb.ora.bak
export ORACLE_SID=+ASM1
asmcmd
cd DG1
asmcmd mkdir testdb
RMAN>BACKUP AS BACKUPSET SPFILE;
RMAN>RESTORE SPFILE TO "+DG1/testdb/spfiletestdb.ora";
RMAN> SHUTDOWN IMMEDIATE;
cd $ORACLE_HOME/dbs
ls
mv inittestdb.ora inittestdb.ora.bak
rm inittestdb.ora
vi inittestdb.ora
#add entry
SPFILE='+DG/testdb/spfiletestdb.ora'
:wq!
mv spfiletestdb.ora spfiletestdb.ora.bak
export ORACLE_SID=testdb
SQL> Startup
SQL> show parameter spfile
SQL> ALTER DATABASE OPEN;
#Convert Datafiles to ASM Location
verify db in archive log mode
rman target/
BACKUP AS COPY DATABASE FORMAT '+DG';
SWITCH DATABASE TO COPY;
run
{
set newname for tempfile '/u01/app/oracle/oradata/testdb/temp01.dbf' to '+DG';
switch tempfile all;
}
RMAN> ALTER DATABASE OPEN;
SQL> select FILE_NAME from dba_data_files;