当前位置:Gxlcms > mysql > 对rman命令reportobsolete的一点说明

对rman命令reportobsolete的一点说明

时间:2021-07-01 10:21:17 帮助过:46人阅读

之前误以为归档的备份集超过备份保留策略后,reportobsolete会报其过期.于是设置了备份冗余策略为1,备份两次归档,发起reportobsolete命令希望能看到过期的归档

之前误以为归档的备份集超过备份保留策略后,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

人气教程排行