众所周知,Oracle Rman的retention policy 在任意一个时刻:只能有一个生效。也就是说,两个retention policy 之间是or的关系。
如下使用catalog数据库完成,因为backup 命令的keep forever关键字只支持catalog
[[email protected] ~]$ rman target / catalog rc/[email protected] Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 15 21:18:06 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: PROD (DBID=275920358) connected to recovery catalog database RMAN> backup database format '/home/oracle/keep_test_%U' keep forever nologs; Starting backup at 15-DEC-14 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=272 devtype=DISK backup will never be obsolete archived logs required to recover from this backup will not be kept RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 12/15/2014 21:20:13 RMAN-06533: KEEP ... NOLOGS option cannot be used when datafiles are fuzzy --->该语法是不行的:fuzzy状态是 database open时,datafile的状态(该状态可以从v$datafile_header中获得) RMAN>backup database format '/home/oracle/keep_test_%U' keep forever logs; Starting backup at 15-DEC-14 using channel ORA_DISK_1 backup will never be obsolete archived logs required to recover from this backup will expire when this backup expires channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/disk1/example_1.dbf input datafile fno=00001 name=/u01/app/oracle/oradata/PROD/disk1/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf input datafile fno=00009 name=/u01/app/oracle/oradata/PROD/disk1/r_1.dbf input datafile fno=00007 name=/u01/app/oracle/oradata/PROD/disk1/users_1.dbf input datafile fno=00008 name=/u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf input datafile fno=00005 name=/u01/app/oracle/oradata/PROD/disk1/indx_1.dbf input datafile fno=00006 name=/u01/app/oracle/oradata/PROD/disk1/tools_1.dbf channel ORA_DISK_1: starting piece 1 at 15-DEC-14 piece handle=/home/oracle/keep_test_0spq8ni4_1_1 tag=TAG20141215T212732 comment=NONE -->备份的开始时间是:20141215T212732 channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55 Finished backup at 15-DEC-14 Starting Control File and SPFILE Autobackup at 15-DEC-14 piece handle=/home/oracle/backup/control/c-275920358-20141215-00 comment=NONE Finished Control File and SPFILE Autobackup at 15-DEC-14 RMAN> [[email protected] ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 15 21:29:56 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /home/oracle/arch Oldest online log sequence 20 Next log sequence to archive 23 Current log sequence 23 ------------------------>此时的日志序列号是23 SQL> alter system switch logfile; System altered. SQL> / System altered. 以下略去归档的切换过程。 SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /home/oracle/arch Oldest online log sequence 30 Next log sequence to archive 33 Current log sequence 33 SQL> ----------------------------------------------------->此时的日志序列号是33 RMAN> backup archivelog all format '/home/oracle/arc_back_after_keep_%U' delete all input; Starting backup at 15-DEC-14 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=21 recid=16 stamp=865127168 input archive log thread=1 sequence=22 recid=17 stamp=866409290 input archive log thread=1 sequence=23 recid=18 stamp=866410210 input archive log thread=1 sequence=24 recid=19 stamp=866410212 input archive log thread=1 sequence=25 recid=20 stamp=866410213 input archive log thread=1 sequence=26 recid=21 stamp=866410218 input archive log thread=1 sequence=27 recid=22 stamp=866410218 input archive log thread=1 sequence=28 recid=23 stamp=866410220 input archive log thread=1 sequence=29 recid=24 stamp=866410221 input archive log thread=1 sequence=30 recid=25 stamp=866410222 input archive log thread=1 sequence=31 recid=26 stamp=866410224 input archive log thread=1 sequence=32 recid=27 stamp=866410224 input archive log thread=1 sequence=33 recid=28 stamp=866410311 channel ORA_DISK_1: starting piece 1 at 15-DEC-14 channel ORA_DISK_1: finished piece 1 at 15-DEC-14 piece handle=/home/oracle/arc_back_after_keep_0upq8nq9_1_1 tag=TAG20141215T213153 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 channel ORA_DISK_1: deleting archive log(s) -------------------------------------------------------->这说明归档可以删除 archive log filename=/home/oracle/arch/1_21_864082022.dbf recid=16 stamp=865127168 archive log filename=/home/oracle/arch/1_22_864082022.dbf recid=17 stamp=866409290 archive log filename=/home/oracle/arch/1_23_864082022.dbf recid=18 stamp=866410210 archive log filename=/home/oracle/arch/1_24_864082022.dbf recid=19 stamp=866410212 archive log filename=/home/oracle/arch/1_25_864082022.dbf recid=20 stamp=866410213 archive log filename=/home/oracle/arch/1_26_864082022.dbf recid=21 stamp=866410218 archive log filename=/home/oracle/arch/1_27_864082022.dbf recid=22 stamp=866410218 archive log filename=/home/oracle/arch/1_28_864082022.dbf recid=23 stamp=866410220 archive log filename=/home/oracle/arch/1_29_864082022.dbf recid=24 stamp=866410221 archive log filename=/home/oracle/arch/1_30_864082022.dbf recid=25 stamp=866410222 archive log filename=/home/oracle/arch/1_31_864082022.dbf recid=26 stamp=866410224 archive log filename=/home/oracle/arch/1_32_864082022.dbf recid=27 stamp=866410224 archive log filename=/home/oracle/arch/1_33_864082022.dbf recid=28 stamp=866410311 Finished backup at 15-DEC-14 Starting Control File and SPFILE Autobackup at 15-DEC-14 piece handle=/home/oracle/backup/control/c-275920358-20141215-01 comment=NONE Finished Control File and SPFILE Autobackup at 15-DEC-14 RMAN> RMAN> list backupset; List of Backup Sets =================== BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 59 21.43M DISK 00:00:02 20-NOV-14 BP Key: 77 Status: AVAILABLE Compressed: NO Tag: TAG20141120T223047 Piece Name: /u01/app/oracle/product/10.2.0/db_1/dbs/01po49gn_1_1 List of Archived Logs in backup set 59 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 6 224560 20-NOV-14 233442 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 60 Full 343.30M DISK 00:01:17 20-NOV-14 BP Key: 78 Status: AVAILABLE Compressed: NO Tag: TAG20141120T223051 Piece Name: /home/oracle/back/db_PROD_20141120 List of Datafiles in backup set 60 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/system01.dbf 2 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf 3 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf 4 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/example_1.dbf 5 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/indx_1.dbf 6 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/tools_1.dbf 7 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/users_1.dbf 8 Full 233448 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 61 5.00K DISK 00:00:01 20-NOV-14 BP Key: 79 Status: AVAILABLE Compressed: NO Tag: TAG20141120T223218 Piece Name: /u01/app/oracle/product/10.2.0/db_1/dbs/03po49ji_1_1 List of Archived Logs in backup set 61 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 7 233442 20-NOV-14 233473 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 62 Full 6.58M DISK 00:00:01 20-NOV-14 BP Key: 80 Status: AVAILABLE Compressed: NO Tag: TAG20141120T223220 Piece Name: /home/oracle/back/c-275920358-20141120-00 Control File Included: Ckp SCN: 233479 Ckp time: 20-NOV-14 SPFILE Included: Modification time: 20-NOV-14 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 63 21.61M DISK 00:00:03 20-NOV-14 BP Key: 81 Status: AVAILABLE Compressed: NO Tag: TAG20141120T225650 Piece Name: /home/oracle/back/arch_PROD_864169010 List of Archived Logs in backup set 63 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 6 224560 20-NOV-14 233442 20-NOV-14 1 7 233442 20-NOV-14 233473 20-NOV-14 1 8 233473 20-NOV-14 233536 20-NOV-14 1 9 233536 20-NOV-14 233559 20-NOV-14 1 10 233559 20-NOV-14 234100 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 64 Full 343.30M DISK 00:01:42 20-NOV-14 BP Key: 82 Status: AVAILABLE Compressed: NO Tag: TAG20141120T225654 Piece Name: /home/oracle/back/db_PROD_864169015 List of Datafiles in backup set 64 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/system01.dbf 2 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf 3 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf 4 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/example_1.dbf 5 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/indx_1.dbf 6 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/tools_1.dbf 7 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/users_1.dbf 8 Full 234104 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 65 2.50K DISK 00:00:01 20-NOV-14 BP Key: 83 Status: AVAILABLE Compressed: NO Tag: TAG20141120T225844 Piece Name: /home/oracle/back/arch_PROD_864169124 List of Archived Logs in backup set 65 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 11 234100 20-NOV-14 234133 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 66 Full 6.58M DISK 00:00:03 20-NOV-14 BP Key: 84 Status: AVAILABLE Compressed: NO Tag: TAG20141120T225846 Piece Name: /home/oracle/back/c-275920358-20141120-01 Control File Included: Ckp SCN: 234139 Ckp time: 20-NOV-14 SPFILE Included: Modification time: 20-NOV-14 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 67 25.15M DISK 00:00:03 20-NOV-14 BP Key: 85 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234144 Piece Name: /home/oracle/back/arch_PROD_864171704 List of Archived Logs in backup set 67 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 6 224560 20-NOV-14 233442 20-NOV-14 1 7 233442 20-NOV-14 233473 20-NOV-14 1 8 233473 20-NOV-14 233536 20-NOV-14 1 9 233536 20-NOV-14 233559 20-NOV-14 1 10 233559 20-NOV-14 234100 20-NOV-14 1 11 234100 20-NOV-14 234133 20-NOV-14 1 12 234133 20-NOV-14 236454 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 68 Full 345.13M DISK 00:01:38 20-NOV-14 BP Key: 86 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234148 Piece Name: /home/oracle/back/db_PROD_864171708 List of Datafiles in backup set 68 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/system01.dbf 2 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf 3 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf 4 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/example_1.dbf 5 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/indx_1.dbf 6 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/tools_1.dbf 7 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/users_1.dbf 8 Full 236458 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 69 2.50K DISK 00:00:01 20-NOV-14 BP Key: 87 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234336 Piece Name: /home/oracle/back/arch_PROD_864171816 List of Archived Logs in backup set 69 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 13 236454 20-NOV-14 236487 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 70 Full 6.58M DISK 00:00:02 20-NOV-14 BP Key: 88 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234338 Piece Name: /home/oracle/back/c-275920358-20141120-02 Control File Included: Ckp SCN: 236493 Ckp time: 20-NOV-14 SPFILE Included: Modification time: 20-NOV-14 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 71 25.16M DISK 00:00:03 20-NOV-14 BP Key: 89 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234346 Piece Name: /home/oracle/back/arch_PROD_20141120 List of Archived Logs in backup set 71 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 6 224560 20-NOV-14 233442 20-NOV-14 1 7 233442 20-NOV-14 233473 20-NOV-14 1 8 233473 20-NOV-14 233536 20-NOV-14 1 9 233536 20-NOV-14 233559 20-NOV-14 1 10 233559 20-NOV-14 234100 20-NOV-14 1 11 234100 20-NOV-14 234133 20-NOV-14 1 12 234133 20-NOV-14 236454 20-NOV-14 1 13 236454 20-NOV-14 236487 20-NOV-14 1 14 236487 20-NOV-14 236502 20-NOV-14 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 72 25.17M DISK 00:00:02 20-NOV-14 BP Key: 90 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234708 Piece Name: /home/oracle/back/arch_0hpo4dvs_1_1 List of Archived Logs in backup set 72 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 6 224560 20-NOV-14 233442 20-NOV-14 1 7 233442 20-NOV-14 233473 20-NOV-14 1 8 233473 20-NOV-14 233536 20-NOV-14 1 9 233536 20-NOV-14 233559 20-NOV-14 1 10 233559 20-NOV-14 234100 20-NOV-14 1 11 234100 20-NOV-14 234133 20-NOV-14 1 12 234133 20-NOV-14 236454 20-NOV-14 1 13 236454 20-NOV-14 236487 20-NOV-14 1 14 236487 20-NOV-14 236502 20-NOV-14 1 15 236502 20-NOV-14 236588 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 73 Full 345.13M DISK 00:01:38 20-NOV-14 BP Key: 91 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234710 Piece Name: /home/oracle/back/db_0ipo4dvu_1_1 List of Datafiles in backup set 73 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/system01.dbf 2 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf 3 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf 4 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/example_1.dbf 5 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/indx_1.dbf 6 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/tools_1.dbf 7 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/users_1.dbf 8 Full 236592 20-NOV-14 /u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 74 3.00K DISK 00:00:01 20-NOV-14 BP Key: 92 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234857 Piece Name: /home/oracle/back/arch_0jpo4e39_1_1 List of Archived Logs in backup set 74 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 16 236588 20-NOV-14 236621 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 75 Full 6.58M DISK 00:00:03 20-NOV-14 BP Key: 93 Status: AVAILABLE Compressed: NO Tag: TAG20141120T234859 Piece Name: /home/oracle/back/c-275920358-20141120-03 Control File Included: Ckp SCN: 236627 Ckp time: 20-NOV-14 SPFILE Included: Modification time: 20-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 76 Full 6.58M DISK 00:00:02 23-NOV-14 BP Key: 94 Status: AVAILABLE Compressed: NO Tag: TAG20141123T023809 Piece Name: /home/oracle/back/c-275920358-20141123-00 Control File Included: Ckp SCN: 263008 Ckp time: 23-NOV-14 SPFILE Included: Modification time: 23-NOV-14 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 195 4.47M DISK 00:00:02 26-NOV-14 BP Key: 200 Status: AVAILABLE Compressed: YES Tag: TAG20141126T183805 Piece Name: /home/oracle/backup/0mpojm4e_1_1 List of Archived Logs in backup set 195 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 17 236621 20-NOV-14 256815 23-NOV-14 1 18 256815 23-NOV-14 283757 26-NOV-14 1 19 283757 26-NOV-14 284462 26-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 196 Full 66.88M DISK 00:01:07 26-NOV-14 BP Key: 201 Status: AVAILABLE Compressed: YES Tag: TAG20141126T183811 Piece Name: /home/oracle/backup/0npojm4j_1_1 List of Datafiles in backup set 196 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/system01.dbf 2 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf 3 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf 4 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/example_1.dbf 5 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/indx_1.dbf 6 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/tools_1.dbf 7 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/users_1.dbf 8 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf 9 Full 284476 26-NOV-14 /u01/app/oracle/oradata/PROD/disk1/r_1.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 197 Full 1.03M DISK 00:00:01 26-NOV-14 BP Key: 202 Status: AVAILABLE Compressed: YES Tag: TAG20141126T183811 Piece Name: /home/oracle/backup/0opojm6u_1_1 Control File Included: Ckp SCN: 284499 Ckp time: 26-NOV-14 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 222 7.00K DISK 00:00:01 26-NOV-14 BP Key: 224 Status: AVAILABLE Compressed: YES Tag: TAG20141126T183929 Piece Name: /home/oracle/backup/0ppojm71_1_1 List of Archived Logs in backup set 222 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 20 284462 26-NOV-14 284502 26-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 232 Full 6.58M DISK 00:00:01 26-NOV-14 BP Key: 234 Status: AVAILABLE Compressed: NO Tag: TAG20141126T183932 Piece Name: /home/oracle/backup/control/c-275920358-20141126-00 Control File Included: Ckp SCN: 284520 Ckp time: 26-NOV-14 SPFILE Included: Modification time: 26-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 269 Full 6.58M DISK 00:00:02 26-NOV-14 BP Key: 272 Status: AVAILABLE Compressed: NO Tag: TAG20141126T184247 Piece Name: /home/oracle/backup/control/c-275920358-20141126-01 Control File Included: Ckp SCN: 284938 Ckp time: 26-NOV-14 SPFILE Included: Modification time: 26-NOV-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 280 Full 349.29M DISK 00:01:54 15-DEC-14 BP Key: 283 Status: AVAILABLE Compressed: NO Tag: TAG20141215T212732 Piece Name: /home/oracle/keep_test_0spq8ni4_1_1 Keep: LOGS Until: FOREVER -------------------------------------------------------------->注意此行!!! List of Datafiles in backup set 280 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/system01.dbf 2 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf 3 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf 4 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/example_1.dbf 5 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/indx_1.dbf 6 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/tools_1.dbf 7 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/users_1.dbf 8 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf 9 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/r_1.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 298 Full 6.58M DISK 00:00:01 15-DEC-14 BP Key: 308 Status: AVAILABLE Compressed: NO Tag: TAG20141215T212929 Piece Name: /home/oracle/backup/control/c-275920358-20141215-00 Control File Included: Ckp SCN: 356856 Ckp time: 15-DEC-14 SPFILE Included: Modification time: 15-DEC-14 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 355 11.60M DISK 00:00:02 15-DEC-14 BP Key: 358 Status: AVAILABLE Compressed: NO Tag: TAG20141215T213153 Piece Name: /home/oracle/arc_back_after_keep_0upq8nq9_1_1 List of Archived Logs in backup set 355 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 21 284502 26-NOV-14 305116 01-DEC-14 1 22 305116 01-DEC-14 356141 15-DEC-14 1 23 356141 15-DEC-14 356890 15-DEC-14 1 24 356890 15-DEC-14 356892 15-DEC-14 1 25 356892 15-DEC-14 356894 15-DEC-14 1 26 356894 15-DEC-14 356897 15-DEC-14 1 27 356897 15-DEC-14 356899 15-DEC-14 1 28 356899 15-DEC-14 356901 15-DEC-14 1 29 356901 15-DEC-14 356903 15-DEC-14 1 30 356903 15-DEC-14 356905 15-DEC-14 1 31 356905 15-DEC-14 356907 15-DEC-14 1 32 356907 15-DEC-14 356909 15-DEC-14 1 33 356909 15-DEC-14 356957 15-DEC-14 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 377 Full 6.58M DISK 00:00:00 15-DEC-14 BP Key: 391 Status: AVAILABLE Compressed: NO Tag: TAG20141215T213157 Piece Name: /home/oracle/backup/control/c-275920358-20141215-01 Control File Included: Ckp SCN: 356975 Ckp time: 15-DEC-14 SPFILE Included: Modification time: 15-DEC-14 RMAN> backup as compressed backupset database format '/home/oracle/full_after_keep_%U';------------------>此时我做了一次db的备份 Starting backup at 16-DEC-14 using channel ORA_DISK_1 channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/disk1/example_1.dbf input datafile fno=00001 name=/u01/app/oracle/oradata/PROD/disk1/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf input datafile fno=00009 name=/u01/app/oracle/oradata/PROD/disk1/r_1.dbf input datafile fno=00007 name=/u01/app/oracle/oradata/PROD/disk1/users_1.dbf input datafile fno=00008 name=/u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf input datafile fno=00005 name=/u01/app/oracle/oradata/PROD/disk1/indx_1.dbf input datafile fno=00006 name=/u01/app/oracle/oradata/PROD/disk1/tools_1.dbf channel ORA_DISK_1: starting piece 1 at 16-DEC-14 channel ORA_DISK_1: finished piece 1 at 16-DEC-14 piece handle=/home/oracle/full_after_keep_10pq96j9_1_1 tag=TAG20141216T014409 comment=NONE ---------->备份的开始时间是:20141216T014409 channel ORA_DISK_1: backup set complete, elapsed time: 00:01:56 Finished backup at 16-DEC-14 Starting Control File and SPFILE Autobackup at 16-DEC-14 piece handle=/home/oracle/backup/control/c-275920358-20141216-00 comment=NONE Finished Control File and SPFILE Autobackup at 16-DEC-14 RMAN> backup as compressed backupset database format '/home/oracle/full_after_keep_%U'; Starting backup at 16-DEC-14 using channel ORA_DISK_1 channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/disk1/example_1.dbf input datafile fno=00001 name=/u01/app/oracle/oradata/PROD/disk1/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf input datafile fno=00009 name=/u01/app/oracle/oradata/PROD/disk1/r_1.dbf input datafile fno=00007 name=/u01/app/oracle/oradata/PROD/disk1/users_1.dbf input datafile fno=00008 name=/u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf input datafile fno=00005 name=/u01/app/oracle/oradata/PROD/disk1/indx_1.dbf input datafile fno=00006 name=/u01/app/oracle/oradata/PROD/disk1/tools_1.dbf channel ORA_DISK_1: starting piece 1 at 16-DEC-14 channel ORA_DISK_1: finished piece 1 at 16-DEC-14 piece handle=/home/oracle/full_after_keep_12pq9736_1_1 tag=TAG20141216T015238 comment=NONE ------------>备份的开始时间是:20141216T015238 channel ORA_DISK_1: backup set complete, elapsed time: 00:02:15 Finished backup at 16-DEC-14 Starting Control File and SPFILE Autobackup at 16-DEC-14 piece handle=/home/oracle/backup/control/c-275920358-20141216-01 comment=NONE Finished Control File and SPFILE Autobackup at 16-DEC-14 RMAN> exit RMAN> report obsolete redundancy 1; -------------------------------------------------->请注意:该命令是按照 redundancy 1 来report obsolete的备份。 Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 59 20-NOV-14 Backup Piece 77 20-NOV-14 /u01/app/oracle/product/10.2.0/db_1/dbs/01po49gn_1_1 Backup Set 60 20-NOV-14 Backup Piece 78 20-NOV-14 /home/oracle/back/db_PROD_20141120 Backup Set 61 20-NOV-14 Backup Piece 79 20-NOV-14 /u01/app/oracle/product/10.2.0/db_1/dbs/03po49ji_1_1 Backup Set 62 20-NOV-14 Backup Piece 80 20-NOV-14 /home/oracle/back/c-275920358-20141120-00 Backup Set 63 20-NOV-14 Backup Piece 81 20-NOV-14 /home/oracle/back/arch_PROD_864169010 Backup Set 64 20-NOV-14 Backup Piece 82 20-NOV-14 /home/oracle/back/db_PROD_864169015 Backup Set 65 20-NOV-14 Backup Piece 83 20-NOV-14 /home/oracle/back/arch_PROD_864169124 Backup Set 66 20-NOV-14 Backup Piece 84 20-NOV-14 /home/oracle/back/c-275920358-20141120-01 Backup Set 67 20-NOV-14 Backup Piece 85 20-NOV-14 /home/oracle/back/arch_PROD_864171704 Backup Set 68 20-NOV-14 Backup Piece 86 20-NOV-14 /home/oracle/back/db_PROD_864171708 Backup Set 69 20-NOV-14 Backup Piece 87 20-NOV-14 /home/oracle/back/arch_PROD_864171816 Backup Set 70 20-NOV-14 Backup Piece 88 20-NOV-14 /home/oracle/back/c-275920358-20141120-02 Backup Set 71 20-NOV-14 Backup Piece 89 20-NOV-14 /home/oracle/back/arch_PROD_20141120 Backup Set 72 20-NOV-14 Backup Piece 90 20-NOV-14 /home/oracle/back/arch_0hpo4dvs_1_1 Backup Set 73 20-NOV-14 Backup Piece 91 20-NOV-14 /home/oracle/back/db_0ipo4dvu_1_1 Backup Set 74 20-NOV-14 Backup Piece 92 20-NOV-14 /home/oracle/back/arch_0jpo4e39_1_1 Backup Set 75 20-NOV-14 Backup Piece 93 20-NOV-14 /home/oracle/back/c-275920358-20141120-03 Backup Set 76 23-NOV-14 Backup Piece 94 23-NOV-14 /home/oracle/back/c-275920358-20141123-00 Backup Set 195 26-NOV-14 Backup Piece 200 26-NOV-14 /home/oracle/backup/0mpojm4e_1_1 Backup Set 196 26-NOV-14 Backup Piece 201 26-NOV-14 /home/oracle/backup/0npojm4j_1_1 Backup Set 197 26-NOV-14 Backup Piece 202 26-NOV-14 /home/oracle/backup/0opojm6u_1_1 Backup Set 222 26-NOV-14 Backup Piece 224 26-NOV-14 /home/oracle/backup/0ppojm71_1_1 Backup Set 232 26-NOV-14 Backup Piece 234 26-NOV-14 /home/oracle/backup/control/c-275920358-20141126-00 Backup Set 269 26-NOV-14 Backup Piece 272 26-NOV-14 /home/oracle/backup/control/c-275920358-20141126-01 Backup Set 298 15-DEC-14 Backup Piece 308 15-DEC-14 /home/oracle/backup/control/c-275920358-20141215-00 Backup Set 377 15-DEC-14 Backup Piece 391 15-DEC-14 /home/oracle/backup/control/c-275920358-20141215-01 Backup Set 411 16-DEC-14 Backup Piece 414 16-DEC-14 /home/oracle/full_after_keep_10pq96j9_1_1 ---------->多了此行,此行就是“备份的开始时间是:20141216T014409”的这个备份,而该备份是在那个keep备份之后的备份。既然keep备份之后的备份都报 obsolete了,而keep的备份却没有报obsolete,这说明keep forever 屏蔽了rman的retention policy。 Backup Set 434 16-DEC-14 Backup Piece 444 16-DEC-14 /home/oracle/backup/control/c-275920358-20141216-00 RMAN> ------------------下面说明将此keep forever的备份 变为obsolete的方法:-------------------------------------------------------- RMAN> change backupset 280 nokeep; allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=290 devtype=DISK keep attributes for the backup are deleted backup set key=280 recid=25 stamp=866410166 RMAN> list backupset 280; ------>此时list backupset 280 就看不到Keep: LOGS Until: FOREVER 的痕迹了。 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 280 Full 349.29M DISK 00:01:54 15-DEC-14 BP Key: 283 Status: AVAILABLE Compressed: NO Tag: TAG20141215T212732 Piece Name: /home/oracle/keep_test_0spq8ni4_1_1 List of Datafiles in backup set 280 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/system01.dbf 2 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf 3 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf 4 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/example_1.dbf 5 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/indx_1.dbf 6 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/tools_1.dbf 7 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/users_1.dbf 8 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/oltp_1.dbf 9 Full 356820 15-DEC-14 /u01/app/oracle/oradata/PROD/disk1/r_1.dbf -----------------------下面再来report obsolete redundancy 1; ------------------------------------------ RMAN> report obsolete redundancy 1; Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 59 20-NOV-14 Backup Piece 77 20-NOV-14 /u01/app/oracle/product/10.2.0/db_1/dbs/01po49gn_1_1 Backup Set 60 20-NOV-14 Backup Piece 78 20-NOV-14 /home/oracle/back/db_PROD_20141120 Backup Set 61 20-NOV-14 Backup Piece 79 20-NOV-14 /u01/app/oracle/product/10.2.0/db_1/dbs/03po49ji_1_1 Backup Set 62 20-NOV-14 Backup Piece 80 20-NOV-14 /home/oracle/back/c-275920358-20141120-00 Backup Set 63 20-NOV-14 Backup Piece 81 20-NOV-14 /home/oracle/back/arch_PROD_864169010 Backup Set 64 20-NOV-14 Backup Piece 82 20-NOV-14 /home/oracle/back/db_PROD_864169015 Backup Set 65 20-NOV-14 Backup Piece 83 20-NOV-14 /home/oracle/back/arch_PROD_864169124 Backup Set 66 20-NOV-14 Backup Piece 84 20-NOV-14 /home/oracle/back/c-275920358-20141120-01 Backup Set 67 20-NOV-14 Backup Piece 85 20-NOV-14 /home/oracle/back/arch_PROD_864171704 Backup Set 68 20-NOV-14 Backup Piece 86 20-NOV-14 /home/oracle/back/db_PROD_864171708 Backup Set 69 20-NOV-14 Backup Piece 87 20-NOV-14 /home/oracle/back/arch_PROD_864171816 Backup Set 70 20-NOV-14 Backup Piece 88 20-NOV-14 /home/oracle/back/c-275920358-20141120-02 Backup Set 71 20-NOV-14 Backup Piece 89 20-NOV-14 /home/oracle/back/arch_PROD_20141120 Backup Set 72 20-NOV-14 Backup Piece 90 20-NOV-14 /home/oracle/back/arch_0hpo4dvs_1_1 Backup Set 73 20-NOV-14 Backup Piece 91 20-NOV-14 /home/oracle/back/db_0ipo4dvu_1_1 Backup Set 74 20-NOV-14 Backup Piece 92 20-NOV-14 /home/oracle/back/arch_0jpo4e39_1_1 Backup Set 75 20-NOV-14 Backup Piece 93 20-NOV-14 /home/oracle/back/c-275920358-20141120-03 Backup Set 76 23-NOV-14 Backup Piece 94 23-NOV-14 /home/oracle/back/c-275920358-20141123-00 Backup Set 195 26-NOV-14 Backup Piece 200 26-NOV-14 /home/oracle/backup/0mpojm4e_1_1 Backup Set 196 26-NOV-14 Backup Piece 201 26-NOV-14 /home/oracle/backup/0npojm4j_1_1 Backup Set 197 26-NOV-14 Backup Piece 202 26-NOV-14 /home/oracle/backup/0opojm6u_1_1 Backup Set 222 26-NOV-14 Backup Piece 224 26-NOV-14 /home/oracle/backup/0ppojm71_1_1 Backup Set 232 26-NOV-14 Backup Piece 234 26-NOV-14 /home/oracle/backup/control/c-275920358-20141126-00 Backup Set 269 26-NOV-14 Backup Piece 272 26-NOV-14 /home/oracle/backup/control/c-275920358-20141126-01 Backup Set 280 15-DEC-14 Backup Piece 283 15-DEC-14 /home/oracle/keep_test_0spq8ni4_1_1 -------------------->此时,该备份就出现在 report obsolete redundancy 1; 的结果中了。 Backup Set 298 15-DEC-14 Backup Piece 308 15-DEC-14 /home/oracle/backup/control/c-275920358-20141215-00 Backup Set 377 15-DEC-14 Backup Piece 391 15-DEC-14 /home/oracle/backup/control/c-275920358-20141215-01 Backup Set 411 16-DEC-14 Backup Piece 414 16-DEC-14 /home/oracle/full_after_keep_10pq96j9_1_1 Backup Set 434 16-DEC-14 Backup Piece 444 16-DEC-14 /home/oracle/backup/control/c-275920358-20141216-00 RMAN>
结论:
backup命令中的 keep forever关键字会 屏蔽rman的retention policy。
时间: 2024-10-11 23:48:56