Oracle 12c RMAN Backup and Recovery
BACKUP FORMAT '/path to location/%d_D_%T_%u_s%s_p%p' DATABASE
BACKUP CURRENT CONTROLFILE FORMAT '/path to location/%d_C_%T_%u';
BACKUP SPFILE FORMAT '/path to location/%d_C_%T_%u';
BACKUP AS COMPRESSED BACKUPSET FORMAT '/path to location/rmanbackup/%u' DATABASE
select 'CHANGE BACKUPPIECE '''||handle||''' uncatalog;' from v$backup_piece where handle is not null order by handle;
BACKUP ARCHIVELOG ALL format '/location/arch_%d_%p_%s.bak' ;
1)
sqlplus> startup pfile='/u03/allianz' nomount;
2)
RMAN>restore controlfile from '/u03/20150225/c-1706605997-20150417-00';
3) alter database mount;
4)
RUN
{
set newname for datafile 1 to '/u01/oracle/datafiles/datafiles/system01.dbf' ;
set newname for datafile 2 to '/u01/oracle/datafiles/datafiles/sysaux01.dbf' ;
set newname for datafile 3 to '/u01/oracle/datafiles/datafiles/system02.dbf' ;
set newname for datafile 4 to '/u01/oracle/datafiles/datafiles/users01.dbf' ;
set newname for datafile 5 to '/u01/oracle/datafiles/datafiles/app01.dbf' ;
set newname for datafile 6 to '/u01/oracle/datafiles/datafiles/core_data01.dbf' ;
set newname for datafile 7 to '/u01/oracle/datafiles/datafiles/core_indx01.dbf' ;
set newname for datafile 8 to '/u01/oracle/datafiles/datafiles/gen_data01.dbf' ;
set newname for datafile 9 to '/u01/oracle/datafiles/datafiles/gen_indx01.dbf' ;
set newname for datafile 10 to '/u01/oracle/datafiles/datafiles/fin_data01.dbf' ;
set newname for datafile 11 to '/u01/oracle/datafiles/datafiles/fin_indx01.dbf' ;
set newname for datafile 12 to '/u01/oracle/datafiles/datafiles/app02.dbf' ;
set newname for datafile 13 to '/u01/oracle/datafiles/datafiles/app03.dbf' ;
set newname for datafile 14 to '/u01/oracle/datafiles/datafiles/undotbs02.dbf' ;
set newname for datafile 15 to '/u01/oracle/datafiles/datafiles/undotbs03.dbf' ;
set newname for datafile 16 to '/u01/oracle/datafiles/datafiles/undotbs04.dbf' ;
set newname for datafile 17 to '/u01/oracle/datafiles/datafiles/app04.dbf' ;
RESTORE DATABASE;
SWITCH DATAFILE ALL;
}
/u01/oracle/datafiles/datafiles
5) create log files
alter database rename file '/u06/oradata/snicdb/redo03.log' to '/u05/snicdbtest/log/redo03.log';
alter database rename file '/u05/oradata/snicdb/redo02.log' to '/u05/snicdbtest/log/redo02.log';
alter database rename file '/u04/app/oracle/oradata/snicdb/redo01.log' to '/u05/snicdbtest/log/redo01.log';
alter database rename file '/u04/app/oracle/oradata/snicdb/redo04.log' to '/u05/snicdbtest/log/redo04.log';
6) RMAN>recover database;
7) sqlplus> alter database open;