Incrementally updated image copy backup:
It is faster to restore from RMAN image (copy) backup still image copy backups were not considered very good practice because it takes longer to take rman copy(image)
backup as they backup whole database block to block backup and also incremental image copy backup was not possible.
Oracle 10g has introduced incrementally updated image copy backup feature. In this feature first
copy backup was taken and then incremntal backup set is taken and image copy backup is updated with this incremental backupset. So basically this is three steps task.
first step: update(recover) the image copy backup
second step : take image copy backup if this does not exist before
and then take incremental level 1 backupset(changed block from image copy backup)
RUN {
RECOVER COPY OF DATABASE WITH TAG 'incr_backup' ;
BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_backup' DATABASE;
}
Note the backuo tags must be same in both rman commands.
Note 1: When above commands are executed for first time. RMAN gives message
"no copy of datafile #n found to recover" as there are no existing image copy backup with given tag
and then take the image copy backup of database.
It does not take the incremental backupset.
Note 2: when above commands are executed for second time, then RMAN again gives message
"no copy of datafile #n found to recover" as there are no existing incremental backupset to apply(recover)
the image copy backup of database with the given tag. and takes the incremental level 1 backupset.
Note3: It performs two steps: First recover the image copy backup of database with incremental backupset.
and then it takes incremental level 1 backup set(backup of changed blocks since image copy backup of database
was taken with given tag
First run:
RMAN> RUN {
2> RECOVER COPY OF DATABASE WITH TAG 'incr_backup' ;
3> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_backup' DATABASE;
4> }
Starting recover at 05-FEB-13
using channel ORA_DISK_1
no copy of datafile 1 found to recover
no copy of datafile 2 found to recover
no copy of datafile 3 found to recover
no copy of datafile 4 found to recover
no copy of datafile 5 found to recover
Finished recover at 05-FEB-13
Starting backup at 05-FEB-13
using channel ORA_DISK_1
no parent backup or copy of datafile 1 found
no parent backup or copy of datafile 3 found
no parent backup or copy of datafile 5 found
no parent backup or copy of datafile 2 found
no parent backup or copy of datafile 4 found
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
output filename=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-SYSTEM_FNO-1_5DO179AR tag=INCR_BACKUP recid=85 stamp=806593907
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
output filename=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-SYSAUX_FNO-3_5EO179BK tag=INCR_BACKUP recid=86 stamp=806593922
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF
output filename=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-EXAMPLE_FNO-5_5FO179C3 tag=INCR_BACKUP recid=87 stamp=806593929
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
output filename=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-UNDOTBS1_FNO-2_5GO179CB tag=INCR_BACKUP recid=88 stamp=806593934
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
output filename=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-USERS_FNO-4_5HO179CI tag=INCR_BACKUP recid=89 stamp=806593938
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 05-FEB-13
Starting Control File and SPFILE Autobackup at 05-FEB-13
piece handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2013_02_05\O1_MF_S_806593939_8K1J9WD4_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 05-FEB-13
Second run:
RMAN> RUN {
2> RECOVER COPY OF DATABASE WITH TAG 'incr_backup' ;
3> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_backup' DATABASE;
4> }
Starting recover at 05-FEB-13
using channel ORA_DISK_1
no copy of datafile 1 found to recover
no copy of datafile 2 found to recover
no copy of datafile 3 found to recover
no copy of datafile 4 found to recover
no copy of datafile 5 found to recover
Finished recover at 05-FEB-13
Starting backup at 05-FEB-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
input datafile fno=00003 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
input datafile fno=00005 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF
input datafile fno=00002 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
input datafile fno=00004 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 05-FEB-13
channel ORA_DISK_1: finished piece 1 at 05-FEB-13
piece handle=D:\ORATEMP\DEF_LOC_5JO179D2_1_1 tag=TAG20130205T135234 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 05-FEB-13
Starting Control File and SPFILE Autobackup at 05-FEB-13
piece handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2013_02_05\O1_MF_S_806593979_8K1JC4OG_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 05-FEB-13
Third run:
RMAN> RUN {
2> RECOVER COPY OF DATABASE WITH TAG 'incr_backup' ;
3> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_backup' DATABASE;
4> }
Starting recover at 05-FEB-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy fno=00001 name=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-SYSTEM_FNO-1_5DO179AR
recovering datafile copy fno=00002 name=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-UNDOTBS1_FNO-2_5GO179CB
recovering datafile copy fno=00003 name=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-SYSAUX_FNO-3_5EO179BK
recovering datafile copy fno=00004 name=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-USERS_FNO-4_5HO179CI
recovering datafile copy fno=00005 name=D:\ORATEMP\DEF_LOC_DATA_D-ORCL_I-1333581083_TS-EXAMPLE_FNO-5_5FO179C3
channel ORA_DISK_1: reading from backup piece D:\ORATEMP\DEF_LOC_5JO179D2_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\ORATEMP\DEF_LOC_5JO179D2_1_1 tag=TAG20130205T135234
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
Finished recover at 05-FEB-13
Starting backup at 05-FEB-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
input datafile fno=00003 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
input datafile fno=00005 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF
input datafile fno=00002 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
input datafile fno=00004 name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 05-FEB-13
channel ORA_DISK_1: finished piece 1 at 05-FEB-13
piece handle=D:\ORATEMP\DEF_LOC_5LO179EJ_1_1 tag=TAG20130205T135323 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
Finished backup at 05-FEB-13
Starting Control File and SPFILE Autobackup at 05-FEB-13
piece handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2013_02_05\O1_MF_S_806594029_8K1JDP83_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 05-FEB-13
Recoverability Window:
If you want to recover to three days ago you can not do from using above backup strategy
so you can alter RMAN commands to as below:
RMAN> RUN {
2> RECOVER COPY OF DATABASE WITH TAG 'incr_backup' until time 'sysdate-3';
3> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_backup' DATABASE;
4> }
Now if you want to recover to 27 hours ago you can recover as below:
RMAN { set until time "to_date('03-feb-2013 03:00:00','dd-mon-yy hh:mi:ss am')";
restore database;
recover database;
}