如果能够了解两个状态的来源,自然就能够理解其中的区别;
EXPIRED状态:
此状态与crosscheck命令相关,crosscheck backup 命令是对备份进行交叉检查,检查备份集是否有效。当crosscheck命令检查到某备份已经在系统层面删除的时候即物理上不存在的时候,就会将available状态置为expired状态,但这个时候并没有真正删除备份【所以删除备份不能在系统层面删除,而应该在rman中删除,使用delete backup】;
如:
RMAN> list backup tag=‘con_bak‘;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
34 Full 9.64M DISK 00:00:02 23-OCT-14
BP Key: 34 Status: AVAILABLE Compressed: NO Tag: CON_BAK
Piece Name: /bak/control19plo5s3_1_1
Control File Included: Ckp SCN: 10309054 Ckp time: 23-OCT-14
[[email protected] ~]$ rm /bak/control19plo5s3_1_1
-- 将该备份从系统上删除
RMAN> crosscheck backup;
-- 交叉检查备份集是否有效
RMAN> list backup tag=‘con_bak‘;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
34 Full 9.64M DISK 00:00:02 23-OCT-14
BP Key: 34 Status: EXPIRED Compressed: NO Tag: CON_BAK
Piece Name: /bak/control19plo5s3_1_1
Control File Included: Ckp SCN: 10309054 Ckp time: 23-OCT-14
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
34 B F X DISK 23-OCT-14 1 1 NO CON_BAK
RMAN> delete noprompt expired backup;
--使用delete expired backup 来删除失效的备份信息
OBSOLETE状态:
obsolete状态是根据rman备份的保留策略来定的,当超过保留策略的备份就会被标记为obsolete状态,使用 report obsolete 命令来查看,使用delete noprompt obselete来删除备份;
如:
RMAN> run{
2> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
3> backup current controlfile format ‘/bak/con_test_%U‘ tag=‘bakcontest‘;
4> }
-- CONFIGURE RETENTION POLICY TO REDUNDANCY 1; 配置rman备份集的保留策略为1,超过一份的就会被标记为obsolete【废弃】状态,使用上述run代码块备份两次;
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 35 23-OCT-14
Backup Piece 35 23-OCT-14 /bak/con_test_1aplo6pd_1_1
--使用 report obsolete 就会显示出废弃的备份集
RMAN> delete noprompt obsolete;
--删除废弃的备份
总结:
obsolete出现主要是由于违背备份的保留策略【废弃】而导致的,删除需用delete obsolete,而expired是在crosscheck检查备份集是否有效,主要表现在只是系统层面上删了备份,而没有删除备份信息,【失效状态】,删除需用delete expired;