【Oracle备份】RMAN备份如何备份完不删除归档并不重复备份归档日志

11.2.0.3数据库环境,使用rman进行归档日志备份,想实现:
(1)每天备份归档日志,备份完并不删除归档日志
(2)归档日志备份成功一次之后,下次再备份的时候rman就自动不会再次备份这个归档日志

 

这个需求可以通过 backup archivelog all not backed up; 语法来实现。 使用该命令如果遇到 满足 not backed up xx times 的归档才会备份,否则即便该归档仍在DISK上未被删除 也不会重复备份, 避免了重复备份带来的问题,也无需每次备份均删除磁盘上的归档文件。

 

RMAN> backup archivelog all not backed up;

Starting backup at 30-NOV-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=31 recid=88 stamp=832886696
input archive log thread=1 sequence=32 recid=89 stamp=832886698
input archive log thread=1 sequence=33 recid=90 stamp=832886701
input archive log thread=1 sequence=34 recid=91 stamp=832886705
input archive log thread=1 sequence=35 recid=92 stamp=832886706
input archive log thread=1 sequence=36 recid=93 stamp=832886707
input archive log thread=1 sequence=37 recid=94 stamp=832886709
input archive log thread=1 sequence=38 recid=95 stamp=832886710
input archive log thread=1 sequence=39 recid=96 stamp=832886717
channel ORA_DISK_1: starting piece 1 at 30-NOV-13
channel ORA_DISK_1: finished piece 1 at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/backupset/2013_11_30/o1_mf_annnn_TAG20131130T212517_99mssy9g_.bkp tag=TAG20131130T212517 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 30-NOV-13

Starting Control File and SPFILE Autobackup at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/autobackup/2013_11_30/o1_mf_s_832886719_99msszd5_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 30-NOV-13

RMAN> backup archivelog all not backed up;

Starting backup at 30-NOV-13
current log archived
using channel ORA_DISK_1
skipping archive log file /s01/arch/1_31_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_32_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_33_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_34_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_35_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_36_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_37_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_38_831398352.dbf; already backed on 30-NOV-13
skipping archive log file /s01/arch/1_39_831398352.dbf; already backed on 30-NOV-13
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=40 recid=97 stamp=832886724
channel ORA_DISK_1: starting piece 1 at 30-NOV-13
channel ORA_DISK_1: finished piece 1 at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/backupset/2013_11_30/o1_mf_annnn_TAG20131130T212524_99mst5k2_.bkp tag=TAG20131130T212524 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 30-NOV-13

Starting Control File and SPFILE Autobackup at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/autobackup/2013_11_30/o1_mf_s_832886726_99mst6n1_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 30-NOV-13

 

 

此外还可以指定 备份几次以上的才不备份, 例如 这里我们要求备份2次或以上的归档 此次才不备份, 那么就是backup archivelog all not backed up 2 times;

 

 

 

RMAN> backup archivelog all not backed up 2 times;

Starting backup at 30-NOV-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=31 recid=88 stamp=832886696
input archive log thread=1 sequence=32 recid=89 stamp=832886698
input archive log thread=1 sequence=33 recid=90 stamp=832886701
input archive log thread=1 sequence=34 recid=91 stamp=832886705
input archive log thread=1 sequence=35 recid=92 stamp=832886706
input archive log thread=1 sequence=36 recid=93 stamp=832886707
input archive log thread=1 sequence=37 recid=94 stamp=832886709
input archive log thread=1 sequence=38 recid=95 stamp=832886710
input archive log thread=1 sequence=39 recid=96 stamp=832886717
input archive log thread=1 sequence=40 recid=97 stamp=832886724
input archive log thread=1 sequence=41 recid=98 stamp=832886806
channel ORA_DISK_1: starting piece 1 at 30-NOV-13
channel ORA_DISK_1: finished piece 1 at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/backupset/2013_11_30/o1_mf_annnn_TAG20131130T212646_99mswr0o_.bkp tag=TAG20131130T212646 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 30-NOV-13

Starting Control File and SPFILE Autobackup at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/autobackup/2013_11_30/o1_mf_s_832886809_99msws3r_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 30-NOV-13

RMAN>  backup archivelog all not backed up 2 times;

Starting backup at 30-NOV-13
current log archived
using channel ORA_DISK_1
skipping archive log file /s01/arch/1_31_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_32_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_33_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_34_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_35_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_36_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_37_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_38_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_39_831398352.dbf; already backed up 2 time(s)
skipping archive log file /s01/arch/1_40_831398352.dbf; already backed up 2 time(s)
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=41 recid=98 stamp=832886806
input archive log thread=1 sequence=42 recid=99 stamp=832886861
channel ORA_DISK_1: starting piece 1 at 30-NOV-13
channel ORA_DISK_1: finished piece 1 at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/backupset/2013_11_30/o1_mf_annnn_TAG20131130T212741_99msygh3_.bkp tag=TAG20131130T212741 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 30-NOV-13

Starting Control File and SPFILE Autobackup at 30-NOV-13
piece handle=/s01/flash_recovery_area/G10R25/autobackup/2013_11_30/o1_mf_s_832886863_99msyhl3_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 30-NOV-13

关注dbDao.com的新浪微博

扫码关注dbDao.com 微信公众号:

Speak Your Mind

TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569