10g RMAN的REDUNDANCY策略改變

yangtingkun發表於2012-07-05

最近發現10gRMAN備份保留REDUNDANCY策略和9i相比發生了改變。

 

 

Oracle9i中,備份保留策略的REDUNDANCY的值,指的是備份冗餘的個數。也就是說,如果REDUNDANCY設定為1,那麼Oracle會保留2個備份。

但是在10g以後,REDUNDANCY的值,就是最終備份保留的值,手頭沒有10g的環境,用11grman做了一個例子:

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的值,就是最終備份保留的個數。為了確認這個問題,特意查詢了一下9i10g的官方文件。

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

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4227/viewspace-734914/,如需轉載,請註明出處,否則將追究法律責任。

相關文章