rman备份,增量备份时,通过tag指定,所参照的0级备份

今天孙姐姐,问我这样一个问题:
请教一个rman增量备份的问题。比如,每个周日做一个level0备份,每天做增量备份。然后,在每个月末在做一次增量备份,要求这个增量备份是以这个月第一个周日的level0为基本备份。这样能实现吗?

这个......我也不知道啊,查查文档,发现一段语法,在Oracle? Database Backup and Recovery Reference

点击(此处)折叠或打开

  1. FOR RECOVER OF TAG tag_name
  2. For example, the BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF TAG wholedb ARCHIVELOG ALL command backs up all archived redo log files needed to recover the level 0 incremental backup tagged wholedb.

看着,是可以通过指定一个tag,来选择增量备份时,参照哪个0级备份

随后,在这段语法后面找到一个example

点击(此处)折叠或打开

  1. Example 2-20 Scripting Incrementally Updated Backups
  2. By incrementally updating backups, you can avoid the overhead of making full image copy backups of data files, while also minimizing media recovery time. For example, if you run a daily backup script, then you never have more than one day of redo to apply for media recovery.
  3. Assume you run the following script daily. On first execution, the script creates an image copy backup of the database on disk with the specified tag. On second execution, the script creates a level 1 differential incremental backup of the database. On every subsequent execution, RMAN applies the level 1 incremental backup to the data file copy and then makes a new level 1 backup.
  4. RUN
  5. {
  6. RECOVER COPY OF DATABASE
  7. WITH TAG 'incr_update';
  8. BACKUP
  9. INCREMENTAL LEVEL 1
  10. FOR RECOVER OF COPY WITH TAG 'incr_update'
  11. DATABASE;
  12. }

参照以上的例子,我在虚拟机上试了一下
先生成一个0级的,tag是wbg的备份

点击(此处)折叠或打开

RMAN> backup INCREMENTAL LEVEL 0 tag 'wbg' format '/home/oracle/%U' database ; Starting backup at 09-OCT-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 0 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.891365639 input datafile file number=00001 name=+DATA/orcl/datafile/system.256.891365639 input datafile file number=00005 name=+DATA/orcl/datafile/example.266.891365749 input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.258.891365639 input datafile file number=00006 name=+DATA/orcl/datafile/undotbs2.267.891365925 input datafile file number=00004 name=+DATA/orcl/datafile/users.259.891365639 channel ORA_DISK_1: starting piece 1 at 09-OCT-15 channel ORA_DISK_1: finished piece 1 at 09-OCT-15 piece handle=/home/oracle/0eqj9jbc_1_1 tag=WBG comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting incremental level 0 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 09-OCT-15 channel ORA_DISK_1: finished piece 1 at 09-OCT-15 piece handle=/home/oracle/0fqj9jbr_1_1 tag=WBG comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 09-OCT-15

然后,参照tag为wbg的备份,生成一个1级备份

点击(此处)折叠或打开

RMAN> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF TAG wbg DATABASE; Starting backup at 09-OCT-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.891365639 input datafile file number=00001 name=+DATA/orcl/datafile/system.256.891365639 input datafile file number=00005 name=+DATA/orcl/datafile/example.266.891365749 input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.258.891365639 input datafile file number=00006 name=+DATA/orcl/datafile/undotbs2.267.891365925 input datafile file number=00004 name=+DATA/orcl/datafile/users.259.891365639 channel ORA_DISK_1: starting piece 1 at 09-OCT-15 channel ORA_DISK_1: finished piece 1 at 09-OCT-15 piece handle=+ARCH/orcl/backupset/2015_10_09/nnndn1_wbg_0.314.892653565 tag=WBG comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 09-OCT-15 channel ORA_DISK_1: finished piece 1 at 09-OCT-15 piece handle=+ARCH/orcl/backupset/2015_10_09/ncsnn1_wbg_0.313.892653581 tag=WBG comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 09-OCT-15

随后,我胡乱瞎写一个tag

点击(此处)折叠或打开

RMAN> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF tag '222222222222233333333' DATABASE; Starting backup at 09-OCT-15 using channel ORA_DISK_1 no parent backup or copy of datafile 2 found no parent backup or copy of datafile 1 found no parent backup or copy of datafile 5 found no parent backup or copy of datafile 3 found no parent backup or copy of datafile 4 found channel ORA_DISK_1: starting incremental level 0 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.891365639 input datafile file number=00001 name=+DATA/orcl/datafile/system.256.891365639 input datafile file number=00005 name=+DATA/orcl/datafile/example.266.891365749 input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.258.891365639 input datafile file number=00004 name=+DATA/orcl/datafile/users.259.891365639 channel ORA_DISK_1: starting piece 1 at 09-OCT-15 channel ORA_DISK_1: finished piece 1 at 09-OCT-15 piece handle=+ARCH/orcl/backupset/2015_10_09/nnndn0_222222222222233333333_0.299.892658295 tag=222222222222233333333 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00006 name=+DATA/orcl/datafile/undotbs2.267.891365925 channel ORA_DISK_1: starting piece 1 at 09-OCT-15 channel ORA_DISK_1: finished piece 1 at 09-OCT-15 piece handle=+ARCH/orcl/backupset/2015_10_09/nnndn1_222222222222233333333_0.298.892658309 tag=222222222222233333333 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 09-OCT-15 channel ORA_DISK_1: finished piece 1 at 09-OCT-15 piece handle=+ARCH/orcl/backupset/2015_10_09/ncsnn1_222222222222233333333_0.297.892658311 tag=222222222222233333333 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 09-OCT-15
日志中看到了:
no parent backup or copy of datafile 2 found no parent backup or copy of datafile 1 found no parent backup or copy of datafile 5 found no parent backup or copy of datafile 3 found no parent backup or copy of datafile 4 found 但是备份成功了,我现在查看一下,多了什么备份

点击(此处)折叠或打开

BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 40 Incr 0 1.45G DISK 00:00:11 09-OCT-15 BP Key: 40 Status: AVAILABLE Compressed: NO Tag: 222222222222233333333 Piece Name: +ARCH/orcl/backupset/2015_10_09/nnndn0_222222222222233333333_0.299.892658295 List of Datafiles in backup set 40 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 0 Incr 2281289 09-OCT-15 +DATA/orcl/datafile/system.256.891365639 2 0 Incr 2281289 09-OCT-15 +DATA/orcl/datafile/sysaux.257.891365639 3 0 Incr 2281289 09-OCT-15 +DATA/orcl/datafile/undotbs1.258.891365639 4 0 Incr 2281289 09-OCT-15 +DATA/orcl/datafile/users.259.891365639 5 0 Incr 2281289 09-OCT-15 +DATA/orcl/datafile/example.266.891365749 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 41 Incr 1 37.02M DISK 00:00:00 09-OCT-15 BP Key: 41 Status: AVAILABLE Compressed: NO Tag: 222222222222233333333 Piece Name: +ARCH/orcl/backupset/2015_10_09/nnndn1_222222222222233333333_0.298.892658309 List of Datafiles in backup set 41 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 6 1 Incr 2281303 09-OCT-15 +DATA/orcl/datafile/undotbs2.267.891365925 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 42 Incr 1 17.73M DISK 00:00:01 09-OCT-15 BP Key: 42 Status: AVAILABLE Compressed: NO Tag: 222222222222233333333 Piece Name: +ARCH/orcl/backupset/2015_10_09/ncsnn1_222222222222233333333_0.297.892658311 SPFILE Included: Modification time: 07-OCT-15 SPFILE db_unique_name: ORCL Control File Included: Ckp SCN: 2281304 Ckp time: 09-OCT-15
由此可见,当你选择的那个tag不存在的话,oracle会帮你先做一个0级备份,并且tag的名字也帮你给上,让增量备份有了自己能参照的0级备份

经过验证,孙姐姐的想法是可以实现的哈!之前感觉木有什么卵用的tag,在这个场景下,非常有用。
oracle的文档很全面,oracle很强大啊。
额。。。。。。赓赓。。。。。。



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30202921/viewspace-1813649/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30202921/viewspace-1813649/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值