對rman命令report obsolete的一點說明
RMAN備份集數量超過備份保留策略後,report obsolete 一定會報其過期嗎?測試設定了備份冗餘策略為1,備份兩次歸檔,發起report obsolete 命令希望能看到過期的歸檔備份集,但結果卻未顯示該備份集obsolete,看來有必要好好研究下,於是有下文。
一 先看看report obsolete命令的官方說明
Lists full backups, data file copies, and archived redo log files recorded in the
RMAN repository that can be deleted because they are no longer needed The command works
in two steps:
For each data file that has been backed up, RMAN identifies the oldest full
backup, level 0 backup, or image copy that is not obsolete under the
retention policy. Any backup of the data file older than the one identified in
this step is considered obsolete.
Any archived redo log files and level 1 incremental backups that are older
than the oldest nonobsolete full backup are considered obsolete. These files
are obsolete because no full or level 0 backup exists to which they can be
applied. Incremental level 1 backups or archived redo log files are not
considered obsolete if they can be applied to nonobsolete level 0 or full
backups.
第一段:
report obsolete命令用於列出rman資料庫中能夠被刪除的全備份、資料檔案複製和歸檔日誌記錄。
report obsolete 命令有兩個過程
第二段:
對資料檔案備份的處理:對於每一個已經備份的資料檔案,rman會在保留策略內標識出一個最老的的全資料備份或者0級別備份,如果其它任何資料檔案備份比已標識的備份還老則再這一步直接認作obsolete
第三段
對歸檔日誌檔案或者增量備份處理:
首先應該有一個參照,這個參照就是保留策略內最老的非obsolete 全備份或者0級備份。
如果歸檔檔案或者增量備份比標識的非obsolete且最老的full backup 還老,則視為obsolete。
如果歸檔檔案或者增量備份能夠被應用在一個非obsolete的全備份或者0級別備份,則歸檔及增量備份為非obsolete,反之則為obsolete。
二 驗證
1 當前資料庫備份保留策略配置如下
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name CRM are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
2 當前資料庫的obsolete備份集情況如下:
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
no obsolete backups found
3 備份資料庫的所有歸檔兩次
RMAN> run{
2> allocate channel c1 type disk;
3> backup archivelog all format '/backup/arch2_%T_%U';
4> release channel c1;
5> }
released channel: ORA_DISK_1
released channel: ORA_DISK_2
released channel: ORA_DISK_3
allocated channel: c1
channel c1: SID=131 device type=DISK
Starting backup at 2013-03-27 16:15:47
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=124 RECID=843 STAMP=811181727
input archived log thread=1 sequence=125 RECID=844 STAMP=811181727
input archived log thread=1 sequence=126 RECID=845 STAMP=811181728
input archived log thread=1 sequence=127 RECID=846 STAMP=811181729
input archived log thread=1 sequence=128 RECID=847 STAMP=811181729
input archived log thread=1 sequence=129 RECID=848 STAMP=811181730
input archived log thread=1 sequence=130 RECID=849 STAMP=811181747
channel c1: starting piece 1 at 2013-03-27 16:15:48
channel c1: finished piece 1 at 2013-03-27 16:15:49
piece handle=/backup/arch2_20130327_0mo5j9lj_1_1 tag=TAG20130327T161547 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 2013-03-27 16:15:49
Starting Control File and SPFILE Autobackup at 2013-03-27 16:15:49
piece handle=/backup/c-3599153036-20130327-04 comment=NONE
Finished Control File and SPFILE Autobackup at 2013-03-27 16:15:50
released channel: c1
RMAN> run{
2> allocate channel c1 type disk;
3> backup archivelog all format '/backup/arch2_%T_%U';
4> release channel c1;
5> }
allocated channel: c1
channel c1: SID=131 device type=DISK
Starting backup at 2013-03-27 16:15:56
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=124 RECID=843 STAMP=811181727
input archived log thread=1 sequence=125 RECID=844 STAMP=811181727
input archived log thread=1 sequence=126 RECID=845 STAMP=811181728
input archived log thread=1 sequence=127 RECID=846 STAMP=811181729
input archived log thread=1 sequence=128 RECID=847 STAMP=811181729
input archived log thread=1 sequence=129 RECID=848 STAMP=811181730
input archived log thread=1 sequence=130 RECID=849 STAMP=811181747
input archived log thread=1 sequence=131 RECID=850 STAMP=811181756
channel c1: starting piece 1 at 2013-03-27 16:15:56
channel c1: finished piece 1 at 2013-03-27 16:15:57
piece handle=/backup/arch2_20130327_0oo5j9ls_1_1 tag=TAG20130327T161556 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 2013-03-27 16:15:57
Starting Control File and SPFILE Autobackup at 2013-03-27 16:15:57
piece handle=/backup/c-3599153036-20130327-05 comment=NONE
Finished Control File and SPFILE Autobackup at 2013-03-27 16:15:58
released channel: c1
4 再次檢視report obsolete的顯示,發現無任何歸檔備份集obsolete情況。
注意:到此為止,資料庫還未做過全備份,即缺乏比較的參照物“the oldest nonobsolete full backup”。
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 838 2013-03-27 16:09:54
Backup Piece 847 2013-03-27 16:09:54 /backup/c-3599153036-20130327-03
Backup Set 840 2013-03-27 16:15:50
Backup Piece 849 2013-03-27 16:15:50 /backup/c-3599153036-20130327-04
5 做一次資料庫全備份(即讓資料庫產生一個“the oldest nonobsolete full backup”)
RMAN> run{
2> allocate channel c1 type disk;
3> backup database format '/backup/fulldb_%T_%U';
4> release channel c1;
5> }
allocated channel: c1
channel c1: SID=131 device type=DISK
Starting backup at 2013-03-27 16:16:58
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00004 name=/oracle/CRM/test2/USERS4.dbf
input datafile file number=00001 name=/oracle/CRM/test2/SYSTEM1.dbf
input datafile file number=00002 name=/oracle/CRM/test2/SYSAUX2.dbf
input datafile file number=00005 name=/oracle/CRM/test2/pos1.dbf
input datafile file number=00003 name=/oracle/CRM/test2/UNDOTBS33.dbf
input datafile file number=00006 name=/oracle/CRM/test2/ERP6.dbf
input datafile file number=00009 name=/oracle/CRM/test2/pos2.dbf
input datafile file number=00007 name=/oracle/CRM/test2/USER017.dbf
input datafile file number=00008 name=/oracle/CRM/test2/TEST8.dbf
channel c1: starting piece 1 at 2013-03-27 16:16:58
channel c1: finished piece 1 at 2013-03-27 16:19:43
piece handle=/backup/fulldb_20130327_0qo5j9nq_1_1 tag=TAG20130327T161658 comment=NONE
channel c1: backup set complete, elapsed time: 00:02:46
Finished backup at 2013-03-27 16:19:44
Starting Control File and SPFILE Autobackup at 2013-03-27 16:19:44
piece handle=/backup/c-3599153036-20130327-06 comment=NONE
Finished Control File and SPFILE Autobackup at 2013-03-27 16:19:47
released channel: c1
6 資料庫的日誌情況如下(可發現當前oracle最後一個歸檔seq號為131)
SQL> select group#,archived,sequence#,status from v$Log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 YES 129 INACTIVE
2 YES 130 INACTIVE
3 YES 131 INACTIVE
4 NO 132 CURRENT
7 現在我們發起report obsolete命令,則系統內所有歸檔備份集和歸檔檔案會和這個保留策略內”the oldest nonobsolete full backup“做比較 凡是無用的歸檔備份集和歸檔日誌則在rman資料庫內標記為obsolete。
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 837 2013-03-27 16:09:48
Backup Piece 846 2013-03-27 16:09:48 /backup/fulldb1_20130327_0ho5j95g_1_1
Archive Log 844 2013-03-27 16:15:27 /oracle/archive/1_125_810495590.dbf
Backup Set 838 2013-03-27 16:09:54
Backup Piece 847 2013-03-27 16:09:54 /backup/c-3599153036-20130327-03
Archive Log 843 2013-03-27 16:15:27 /oracle/archive/1_124_810495590.dbf
Archive Log 845 2013-03-27 16:15:28 /oracle/archive/1_126_810495590.dbf
Archive Log 846 2013-03-27 16:15:29 /oracle/archive/1_127_810495590.dbf
Archive Log 847 2013-03-27 16:15:29 /oracle/archive/1_128_810495590.dbf
Archive Log 848 2013-03-27 16:15:30 /oracle/archive/1_129_810495590.dbf
Archive Log 849 2013-03-27 16:15:47 /oracle/archive/1_130_810495590.dbf
Backup Set 839 2013-03-27 16:15:48
Backup Piece 848 2013-03-27 16:15:48 /backup/arch2_20130327_0mo5j9lj_1_1
Backup Set 840 2013-03-27 16:15:50
Backup Piece 849 2013-03-27 16:15:50 /backup/c-3599153036-20130327-04
Archive Log 850 2013-03-27 16:15:56 /oracle/archive/1_131_810495590.dbf
Backup Set 841 2013-03-27 16:15:56
Backup Piece 850 2013-03-27 16:15:56 /backup/arch2_20130327_0oo5j9ls_1_1
Backup Set 842 2013-03-27 16:15:58
Backup Piece 851 2013-03-27 16:15:58 /backup/c-3599153036-20130327-05
總結:
1 歸檔備份集如果obsolete,,則恢復資料庫時該備份集所包含的歸檔無須被應用到保留策略內最舊非obsolete的一個全備份。
2 歸檔檔案如果obsolete,則這些歸檔檔案在資料庫進行恢復時無須被應用到備份保留策略內最舊非obsolete的一個全庫備份上。
3 crosscheck只能夠檢測備份集是否有效(最常見的情況就是物理上是否還存在),並且可以用它來刪除失效(expired)的備份集,而不是用來刪除違背備份策略(obsolete)的備份集,如果要刪除違背備份策略(廢棄)的備份集,需要使用obsolete操作。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27785870/viewspace-2106563/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN的list和report命令詳解2015-04-01
- ip 命令的說明2014-02-18
- RMAN : set newname for命令的一點研究2008-05-22
- RMAN的crosscheck和obsolete的用法2014-03-10ROS
- dd命令說明2007-01-27
- free命令的說明(ZT)2008-07-14
- JPA中對映關係詳細說明(一對多,多對一,一對一、多對多)、@JoinColumn、mappedBy說明2018-06-22APP
- 說說10g rman的catalog命令2008-04-15
- java 關於操作Collection的一點說明2013-11-21Java
- linux ar命令的說明2010-11-08Linux
- vi的替換命令說明2009-05-04
- wc 命令使用說明2018-07-22
- lsof命令功能說明2014-11-24
- RMAN故障一例(歸檔的備份,從不obsolete)2016-08-30
- RMAN說,我能備份(16)--RMAN中的SET命令2010-03-05
- RMAN命令configure,report,list,crosscheck,delete的使用方法2017-11-10ROSdelete
- Oracle Rman 命令詳解(List report backup configure)2011-03-23Oracle
- Linux: yum 命令說明2018-03-09Linux
- AIX errpt命令說明2013-07-31AI
- Linux awk 命令 說明2011-03-25Linux
- 交換機配置命令說明2007-10-22
- RMAN 中delete exipired 和 delete obsolete 的區別2016-04-06delete
- Rman備份中obsolete和expired的區別2009-11-30
- 客戶端網路配置上的一點說明2015-05-06客戶端
- UDEV規則的匹配鍵和RAW的一點說明2017-06-23dev
- MySQL EXPLAIN命令的主要專案說明2018-07-23MySqlAI
- linux的wget命令使用說明2014-11-24Linuxwget
- 使用RMAN report need backup命令檢查備份時遇到一個詭異的問題2015-06-06
- linux常見命令說明2018-03-07Linux
- SQLSERVER 備份BCP命令說明2017-10-10SQLServer
- mysql幫助命令使用說明2016-05-12MySql
- mosquitto命令引數說明2015-02-22UI
- SVN常用命令說明2013-07-01
- 效能分析命令輸出說明2006-09-20
- redis info命令詳細說明2016-03-25Redis
- VI 命令簡易使用說明2008-01-30
- rman report list crosscheck delete2011-07-16ROSdelete
- 【FLASHBACK】關於閃回資料庫的一點說明2017-07-02資料庫