10g RMAN的REDUNDANCY策略改变

最近发现10g的RMAN备份保留REDUNDANCY策略和9i相比发生了改变。
在Oracle9i中,备份保留策略的REDUNDANCY的值,指的是备份冗余的个数。也就是说,如果REDUNDANCY设置为1,那么Oracle会保留2个备份。
但是在10g以后,REDUNDANCY的值,就是最终备份保留的值,手头没有10g的环境,用11g的rman做了一个例子:

solaris*orcl-/home/oracle$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production ON Sun Jul 8 19:04:43 2012
Copyright (c) 1982, 2011, Oracle AND/OR its affiliates.  ALL rights reserved.
connected TO target DATABASE: ORCL (DBID=1299676637)
RMAN> SHOW retention policy;
USING target DATABASE control file instead OF recovery catalog
RMAN configuration parameters FOR DATABASE WITH db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # DEFAULT
RMAN> backup tablespace ts_32k;
Starting backup at 08-JUL-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=180 device TYPE=DISK
channel ORA_DISK_1: starting FULL datafile backup SET
channel ORA_DISK_1: specifying datafile(s) IN backup SET
INPUT datafile file NUMBER=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_ts_32k_7w1w3zmb_.dbf
channel ORA_DISK_1: starting piece 1 at 08-JUL-12
channel ORA_DISK_1: finished piece 1 at 08-JUL-12
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_08/o1_mf_nnndf_TAG20120708T190559_7zltdqxy_.bkp tag=TAG20120708T190559 comment=NONE
channel ORA_DISK_1: backup SET complete, elapsed TIME: 00:00:01
Finished backup at 08-JUL-12
RMAN> backup tablespace ts_32k;
Starting backup at 08-JUL-12
USING channel ORA_DISK_1
channel ORA_DISK_1: starting FULL datafile backup SET
channel ORA_DISK_1: specifying datafile(s) IN backup SET
INPUT datafile file NUMBER=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_ts_32k_7w1w3zmb_.dbf
channel ORA_DISK_1: starting piece 1 at 08-JUL-12
channel ORA_DISK_1: finished piece 1 at 08-JUL-12
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_08/o1_mf_nnndf_TAG20120708T190609_7zltf22b_.bkp tag=TAG20120708T190609 comment=NONE
channel ORA_DISK_1: backup SET complete, elapsed TIME: 00:00:02
Finished backup at 08-JUL-12
RMAN> list backup OF tablespace ts_32k;
 
List OF Backup Sets
===================
 
BS KEY  TYPE LV SIZE       Device TYPE Elapsed TIME Completion TIME
------- ---- -- ---------- ----------- ------------ ---------------
20      FULL    2.69M      DISK        00:00:01     08-JUL-12      
        BP KEY: 20   STATUS: AVAILABLE  Compressed: NO  Tag: TAG20120708T190559
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_08/o1_mf_nnndf_TAG20120708T190559_7zltdqxy_.bkp
  List OF Datafiles IN backup SET 20
  File LV TYPE Ckp SCN    Ckp TIME  Name
  ---- -- ---- ---------- --------- ----
  5       FULL 28932281   08-JUL-12 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_ts_32k_7w1w3zmb_.dbf
BS KEY  TYPE LV SIZE       Device TYPE Elapsed TIME Completion TIME
------- ---- -- ---------- ----------- ------------ ---------------
21      FULL    2.69M      DISK        00:00:01     08-JUL-12      
        BP KEY: 21   STATUS: AVAILABLE  Compressed: NO  Tag: TAG20120708T190609
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_08/o1_mf_nnndf_TAG20120708T190609_7zltf22b_.bkp
  List OF Datafiles IN backup SET 21
  File LV TYPE Ckp SCN    Ckp TIME  Name
  ---- -- ---- ---------- --------- ----
  5       FULL 28932300   08-JUL-12 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_ts_32k_7w1w3zmb_.dbf
RMAN> DELETE obsolete;
RMAN retention policy will be applied TO the command
RMAN retention policy IS SET TO redundancy 1
USING channel ORA_DISK_1
Deleting the following obsolete backups AND copies:
TYPE                 KEY    Completion TIME    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup SET           20     08-JUL-12         
  Backup Piece       20     08-JUL-12          /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_08/o1_mf_nnndf_TAG20120708T190559_7zltdqxy_.bkp
Do you really want TO DELETE the above objects (enter YES OR NO)? yes
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_07_08/o1_mf_nnndf_TAG20120708T190559_7zltdqxy_.bkp RECID=20 STAMP=788123159
Deleted 1 objects

可以看到,从10g开始设置的REDUNDANCY的值,就是最终备份保留的个数。为了确认这个问题,特意查询了一下9i和10g的官方文档。
9i的说法是:

The REDUNDANCY parameter specifies that any NUMBER OF backups OR copies beyond a specified NUMBER need NOT be retained.

而10g的文档中,该参数的描述变为:

A redundancy-based backup retention policy determines whether a backup IS obsolete based ON how many backups OF a file are currently ON disk.

Oracle改变功能的实现很常见,但是没有想到,对于这种细节的定义也会调整。对于熟悉9i备份策略的DBA需要留神,在设置10g以后的RMAN备份保留策略时,需要在9i的基础上增加1。

This entry was posted in ORACLE and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *