DELETE OBSOLETE不删除归档日志以及归档的备份集

今天遇到一个奇怪的事情,使用OBSOLETE不删除归档日志,而且也不删除过期的归档的BACKUP SET
从delete obsolete的概念来看如下:

The REPORT OBSOLETE and DELETE OBSOLETE commands work in two steps:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
   For each datafile for which there are full backup, datafile copy, or level 0 incremental backups, RMAN identifies the oldest full or
level 0 backup or copy that is not obsolete under the retention policy being tested. Any full backup, level 0 incremental backup, or
datafile copy of a datafile older than the one identified in this step is considered obsolete.                                                                                                                                                                                                                                                                                                                                                                          Rman Not Deleting Obsolete Archive Logs And Archive Log Backups (文档 ID 282617.1)
   Any archived logs and level 1 incremental backups that are older than the oldest non-obsolete full backup are then obsolete because
there is no full or level 0 backup to which they can be applied.                                                                                                                                                                    
可以看到所谓的冗余策略不管是天数还是副本数量,保证的都是你冗余时间或者副本最早的那一个FULL BACKUP DATABASE(FULL BACK 或者LEVEL 0增量备份)
是能够恢复的,而早于这个FULL BACKUP以前的增量备份和归档日志或者其他备份都是失效的。简单的说delete obsolete会删除已经没有用的不用于恢复的
归档日志。但是今天遇到的问题是明显的已经处于无用状态的归档任然保留,delete obsolete不能删除。

查看MOS发现问题如下:


once the datafile is identified, the file must be brought up to date with the other files. To do this, execute the following steps:

# If file is Offline:


1. Recover datafile XX:

    alter database recover datafile XX

    -- recovery will apply archives.


2. Set the Datafile Online

     alter database datafile XX online;

 

or

# If tablespace is in begin backup mode:

1. sql> alter tablespace end backup;

 

Once file is brought upto date, RMAN will not have the need to retain older archivelog files.

简单的说就是如果有数据文件处于OFFLINE 状态或者HOT BACKUP 状态,一旦重新ONLINE这个数据文件或者END BACKUP这个文件
是需要归档来进行恢复,所以是不能删除的,所以马上查看数据文件状态如下:

查询过程和处理过程
SQL> select * from dba_data_files;
 
FILE_NAME                                                ONLINE_STATUS
-------------------------------------------------------- -------------
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\USERS01.DBF       ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\SYSAUX01.DBF      ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\UNDOTBS01.DBF     ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\SYSTEM01.DBF      SYSTEM
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\TEST01.DBF        ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\UNTDOTBS01.DBF    ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\TESTCK.DBF        RECOVER
 
7 rows selected
 
SQL> drop tablespace testck;
 
drop tablespace testck
 
ORA-01549: tablespace not empty, use INCLUDING CONTENTS option
 
SQL> drop tablespace testck including contents and datafiles;
 
Tablespace dropped
 
SQL> select * from dba_data_files;
 
FILE_NAME                                                ONLINE_STATUS
-------------------------------------------------------- -------------
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\USERS01.DBF       ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\SYSAUX01.DBF      ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\UNDOTBS01.DBF     ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\SYSTEM01.DBF      SYSTEM
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\TEST01.DBF        ONLINE
C:\ORACLE\PRODUCT\10.2.0\ORADATA\BENDI\UNTDOTBS01.DBF    ONLINE
 
6 rows selected

我删除了表空间后,REPORT OBSOLETE可以正常删除过期的归档和归档备份集。


当然也有MOS文章说还有一种可能的情况就是BUG。
Bug 12412131 - Archivelog backups are not being deleted by 'DELETE OBSOLETE' (文档 ID 12412131.8)

 

 

 

 

 

 


 

上一篇:jquery serialize序列化中文乱码问题


下一篇:Mysql show Status参数详解