RMAN 的备份保留策略:
命令格式:
configure retention policy clear ---------------备份保留策略使用默认值
configure retention policy to none------------不采用任何备份保留策略
configure retention policy to recover window of integer days------------基于时间的备份保留策略,保留几天前的备份文件
configure retention policy to redundancy integer-------基于冗余备份的备份保留策略,对备份文件保留几个冗余备份
1:基于时间
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
保留七天内的所有备份。
2:基于冗余备份
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3
为每个数据文件保留3个冗余备份。
备份保留策略不需要的文件是废弃状态的文件,比如:八天前的数据文件和时间最早的第四个冗余备份
REPORT OBSOLETE命令查看当前处于废弃状态的备份文件
DELETE OBSOLET 命令可立刻删除备份保留策略 不需要的文件(废弃文件)。
====文档解释====
Configuring a Retention Policy
Retention policy governs how long database backups are retained, and
determines how far into the past you can recover your database. Retention policy
can be set in terms of a recovery window (how far into the past you need to be
able to recover your database), or a redundancy value (how many backups of
each file must be retained). Choosing an effective retention policy is a vital part
of your backup strategy.
This command ensures that RMAN retains all backups needed to recover the
database to any point in time in the last 7 days:
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
This command ensures that RMAN retains three backups of each datafile:
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
Use DELETE OBSOLETE to immediately delete backups no longer required by the
retention policy. (For backups stored in a flash recovery area, you do not need to
perform this step. The database automatically deletes obsolete backups in the
flash recovery area when space is needed, as well as files that have been backed
up to a media manager.)
=======end===============================================