- RMAN recovery window Retention Policy Tips
- Question: I need to understand the concept of RMAN retention policy settings and the idea of a retention policy for a specific recovery windows. How does the recovery window relate to the retention policy?
- RMAN Recovery Window Retention Policy
- Информационные технологии, интернет, веб программирование, IT, Hi-Tech, …
- Использование FRA и RMAN – ч.3 – настройка политики сохранения бэкапов на основе окна восстановления или избыточности
- Конфигурация Политики Хранения Бэкапов
- Конфигурация Политики Хранения, Основанной на Окне Восстановления
- Конфигурирование Политики Хранения, Основанной на Избыточности
- Вывод Текущей Политики Хранения
- Отключение Политики Хранения
- Как Oracle Управляет Дисковым Пространством в Мгновенной Области Восстановления
- Когда Файлы являются Пригодными для Удаления из Мгновенной Области Восстановления
- Когда Пространство Мгновенной Области Восстановления Не Доступно
RMAN recovery window Retention Policy Tips
Expert Oracle Database Tips by Donald Burleson March 25, 2015
Question: I need to understand the concept of RMAN retention policy settings and the idea of a retention policy for a specific recovery windows. How does the recovery window relate to the retention policy?
Answer (by Aman Sharma): The Recovery Window retention policy doesn’t just keep the last N days of the backup. It calculates the point-of-recovery (POR) value, accounting the current date and the number of the days mentioned in the retention policy.
The POR is more than just the backup of the last N days. In addition, you would also need the backup of all those which come under the calculation of POR. For example, assume today is 20th of April (we shall not count year here since it’s not needed) and you decide to go with the Recovery Window of 2 days.
In the case of non-incremental backup, this is how it would look:
Current_Date Status POR
20-April Available 20-2=18th April
21-April Available 21-2= 19th April
22-April Available 22-2=20th April
23-April Backup of 20th Obsoleted 23-2=21st April
So in the case of 23rd, the backup would be marked as obsolete.
The same would be true in the case of the incremental backup as well with one additional layer that now, instead of just one backup, oracle would consider this also that whether the backup is a level 0 or level 1 backup and won’t consider the backup of level 1 obsolete if it’s still needed for the recovery.
RMAN Recovery Window Retention Policy
It is always important to have backups of the database. In the same manner, it is also important to delete those backups which are no longer required for the recovery. RMAN makes the identification of these backups very easy using retention policy, which governs which backups are safe to be deleted.
Using retention policy, backups are marked as obsolete, which means not required anymore. There are two possible settings for retention policy:
Redundancy stands for the number of copies that must be available. Once you have the chosen number of backup copies, any older backups are marked as obsolete. This does not put any sort of restriction on how long the backups can be kept. This kind of setting works best for environments where, depending on the SLA (service level agreement), some specified number of backup copies must be kept. By default, this is the setting on which RMAN works, using only the most current backup copy. Depending on the requirement, the number of copies can be changed using the configure command like the following:
RMAN> configure retention policy to redundancy 2;
In the above example, the redundancy has been set to two. This means that if you take two backups of your database now, the oldest copy of the backup would be marked as obsolete.
The other setting, recovery window, is not based on the number of backup copies, but on the number of days for which you want to keep the backup. This does not put any condition on the number of backup copies that can be retained; you can have n number of copies within the specified period of the recovery window. Any backup that is older than the recovery window is marked as obsolete.
In the recovery window, Oracle checks the current backup and looks for its relevance backwards in time. This is a default set to seven days which means that the backup must be kept for exactly seven days, ensuring that you can use it for the recovery within any point of time for this time period. Any file which does not come in this range of n days would require a backup to be done for it and the same would be reported from RMAN as well. To illustrate the above, look at a hypothetical situation where the backup is done after every week and the recovery window is also set for seven days, its default value.
You can see here that the backup is taken every seventh day. Now assume that you started on July 1st and have taken backups on the 8th, 15th, 22nd and 29th of July. Assuming the current date is the 25th of July, according to the recovery window of seven days, the point of recoverability goes up to the 18th of July. This means that to ensure the recoverability, the backup taken on 15th will be kept by Oracle so that you can recover up to that point.
One interesting part of this type of retention policy setting is that it is not mandatory for RMAN to keep the backup only for the mentioned number of days. If you have taken the last level 0 backup and the time period of that exceeds the recovery window timing, Oracle would have to ensure that it is not marked as obsolete because just using the level 1 backup will not guarantee the complete recovery.
The default retention policy is set to a redundancy of 1. You can change it from its default value by using the configure command . Note that both redundancy and recovery window retention policies are mutually exclusive. Now see what retention policy your database is set to. You can use the show retention policy command for this:
RMAN> show retention policy;
RMAN configuration parameters are:
configure retention policy to redundancy 1;
So you have the retention policy set to redundancy 1. Change it to the recovery window of seven days:
RMAN> configure retention policy to recovery window of 7 days;
old RMAN configuration parameters:
configure retention policy to redundancy 1;
new RMAN configuration parameters:
configure retention policy to recovery window of 7 days;
new RMAN configuration parameters are successfully stored
So now you have the retention policy set to seven days of the recovery window. In case you want to disable the retention policy for some reason, you can even do that. Here is how.
configure retention policy to none;
This would disable the retention policy settings. However, doing so would stop the report obsolete and delete obsolete commands from marking any of your previously done backups as obsolete.
Burleson is the American Team
Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on our Oracle forum .
Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.
Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just e-mail:
and include the URL for the page.
Замечание: Если Вы используете мгновенную область восстановления, то Вам не следует запускать вашу базу данных с отключенной политикой сохранения. Если файлы никогда не становятся устаревшими, то файл может быть удален из FRA только в том случае, если он был взят в бэкап в каком-либо другом местоположении на диске или на третьеразрядном устройстве хранения, таком как лента. Вполне вероятно, что все пространство вашей области восстановления будет использовано. Это станет помехой нормальной работе вашей БД, как описано ниже (“Когда Пространство в Мгновенной Области Восстановления Не Доступно”). |
Как Oracle Управляет Дисковым Пространством в Мгновенной Области Восстановления
Oracle не удаляет пригодные для удаления файлы из мгновенной области восстановления, пока пространство не понадобится для некоторой другой цели. В результате файлы, недавно перенесенные на ленту, часто бывают по прежнему доступны на диске для использования в восстановлении. Область восстановления таким образом может служить как своего рода кэш для ленты. Как только FRA становится полной, Oracle автоматически удаляет пригодные для удаления файлы, чтобы освободить пространство в мгновенной области восстановления, при необходимости.
Когда Файлы являются Пригодными для Удаления из Мгновенной Области Восстановления
Существуют относительно простые правила, управляющие тем, когда файлы становятся пригодными для удаления из мгновенной области восстановления:
- Постоянные файлы никогда не являются пригодными для удаления.
- Файлы, которые являются устаревшими согласно политике сохранения, пригодны для удаления.
- Временные файлы, которые были скопированы на ленту, доступны для удаления.
- В среде Data Guard политика удаления архивных журналов транзакций управляет тем, когда архивные redo журналы могут быть удалены из FRA.
Замечание: Точно предсказать, какие из пригодных для удаления файлов будут удалены, – невозможно. Правила, управляющие выбором конкретных файлов для удаления, могут меняться между релизами и зависят от вашей конфигурации. Безопасный и надежный способ контроля удаления файлов из мгновенной области восстановления состоит в изменении вашей политики сохранения. Если Вы желаете увеличить вероятносить того, что файлы, перенесенные на ленту, также останутся и на диске, чтобы минимизировать ожидаемую продолжительносить реставрации и восстановления, увеличьте квоту FRA. |
Когда Пространство Мгновенной Области Восстановления Не Доступно
Если, к примеру, политика сохранения RMAN требует хранения набора бэкапов большего суммарного размера, чем дисковая квота мгновенной области восстановления, или политика сохранения установлена в NONE, то FRA может заполнится окончательно, не имея пространства, которое можно было бы освободить.
База данных генерирует предупреждение, когда пространство, пригодное для освобождения, меньше 15%, и критическое предупреждение, когда это пространство меньше 3%. Чтобы предупредить DBA об этом обстоятельстве, добавляется запись в журнал предупреждений, а также в таблицу DBA_OUTSTANDING_ALERTS (используемую Энтерпрайз Менеджером). Однако, база данных продолжает потреблять место в мгновенной области восстановления до тех пор, пока места, которое еще можно освободить, не останется совсем.
Когда область восстановления окончательно заполнится, Вы получите ошибку:
где nnnnn – это требуемое количество байтов, а mmmm – это дисковая квота для FRA.
База данных обрабатывает мгновенную область восстановления с недостаточным количеством места, пригодного для освобождения, в точности так же, как она обрабатывает обстоятельство заполненного диска. Часто, но не всегда, результатом будет зависание базы данных. Например, если FRA является одним из ваших обязательных местоназначений архивирования журналов транзакций, и база данных не может заархивировать новый журнал из-за того, что область восстановления заполнена, то архиватор может, в зависимости от вашей конфигурации, начать пытаться архивировать периодически, пока место области восстановления не освободится.