The image copies can be incrementally updated in RMAN. Therefore, the main purposes of the following RMAN script are to update the image copy and backup new incremental for this copy.
In this strategy, we can schedule the image copies incremental backup every weeknight. Here are the scripts we use:
Create a new incremental image copies RMAN script.
[oracle@primary01 rman_scripts]$ vi incremental_image_copies.rman
run {
recover copy of database
with tag 'incremental_copies';
backup
incremental level 1
for recover of copy with tag 'incremental_copies'
database;
}
Modify the shell script.
[oracle@primary01 rman_scripts]$ vi run_rman_daily_backup.sh
#!/bin/bash
. /home/oracle/.bash_profile
WORK_DIR=/home/oracle/rman_scripts
rman target / @$WORK_DIR/incremental_image_copies.rman >> $WORK_DIR/backup_log_`date +%Y%m%d`.log
If there is no image copy before the first time of executing the script, RMAN will create an initial image copy like this:
RMAN> run {
2> recover copy of database
3> with tag 'incremental_copies';
4> backup
5> incremental level 1
6> for recover of copy with tag 'incremental_copies'
7> database;
8> }
9>
Starting recover at 31-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=100 instance=primdb1 device type=DISK
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
no copy of datafile 6 found to recover
Finished recover at 31-JAN-13
Starting backup at 31-JAN-13
using channel ORA_DISK_1
no parent backup or copy of datafile 1 found
no parent backup or copy of datafile 2 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 6 found
no parent backup or copy of datafile 4 found
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/primdb/datafile/system.897.797943475
output file name=+DATA/primdb/datafile/system.1216.806165637 tag=INCREMENTAL_COPIES RECID=16 STAMP=806165722
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:36
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/primdb/datafile/sysaux.898.797943569
output file name=+DATA/primdb/datafile/sysaux.1217.806165733 tag=INCREMENTAL_COPIES RECID=17 STAMP=806165825
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:41
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/primdb/datafile/undotbs1.899.797943687
output file name=+DATA/primdb/datafile/undotbs1.1218.806165837 tag=INCREMENTAL_COPIES RECID=18 STAMP=806165850
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/primdb/datafile/example.900.805911471
output file name=+DATA/primdb/datafile/example.1219.806165853 tag=INCREMENTAL_COPIES RECID=19 STAMP=806165863
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/primdb/datafile/undotbs2.901.797943737
output file name=+DATA/primdb/datafile/undotbs2.1220.806165869 tag=INCREMENTAL_COPIES RECID=20 STAMP=806165874
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/primdb/datafile/users.902.805911473
output file name=+DATA/primdb/datafile/users.1221.806165875 tag=INCREMENTAL_COPIES RECID=21 STAMP=806165878
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 31-JAN-13
Starting Control File and SPFILE Autobackup at 31-JAN-13
piece handle=+DATA/primdb/autobackup/2013_01_31/s_806165882.1222.806165885 comment=NONE
Finished Control File and SPFILE Autobackup at 31-JAN-13
Recovery Manager complete.