Skip to main content

RMAN RETENTION POLICIES - REDUNDANCY AND RECOVERY WINDOW


RECOVER WINDOW AND REDUNDANCY

The redundancy retention policy defines a fixed number of backups that need to be retained by RMAN. If there are a number of backups later than the number defined by the retention policy, then those backups can be deleted using the DELETE OBSOLETE command, which we will discuss in the next section.

To set a redundancy retention policy, use the configure retention policy command, as shown here:

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 7;

RMAN> show all;
RMAN configuration parameters are:
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1; -

NOTE: Here it will keep only 1 backup copy. Rest all previous backups marked as OBSOLETE

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
-------------------- ------ ------------------ --------------------
Archive Log          9      26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_19_BP8BD2MV_.ARC
Archive Log          10     26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_20_BP8BFSC1_.ARC
Archive Log          11     26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_21_BP90WVBV_.ARC
Backup Set           24     26-MAY-15
  Backup Piece       24     26-MAY-15          D:\DATA_XE\RMANC-2761439438-20150526-08

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 4;

NOTE: Here it will keep up to four backup sets. Rest all backups marked as OBSOLETE.

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 4;
new RMAN configuration parameters are successfully stored

RMAN> REPORT OBSOLETE;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 4
no obsolete backups found


RECOVERY WINDOW:

The recovery window retention policy is used to ensure that a backup is available that will facilitate a recovery within the defined time window. For example, if the recovery window is set to seven days, then no backup will be reported as obsolete unless it is older than 7 days, the defined recovery window retention time.

To set a recovery window retention policy, use the CONFIGURE RETENTION POLICY command, as shown in the following example:

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; - Default value

NOTE: In this case, we have configured a retention policy of seven days. When the DELETE OBSOLETE command is executed, only backups older than seven days will be reported as obsolete.

Note: If the control_file_record_keep_time database parameter value is less than the time set for the retention policy, you will need to use a recovery catalog.


RMAN> REPORT OBSOLETE;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 1 days
no obsolete backups found


RMAN> show all;

RMAN configuration parameters are:
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;

RMAN> configure retention policy to recovery window of 0 days;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 0 DAYS;
new RMAN configuration parameters are successfully stored

RMAN> report obsolete;

NOTE: Here it will show all previous days backups.

RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 0 days
Report of obsolete backups and copies
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log          9      26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_19_BP8BD2MV_.ARC
Archive Log          10     26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_20_BP8BFSC1_.ARC
Archive Log          11     26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_21_BP90WVBV_.ARC
Backup Set           23     26-MAY-15
  Backup Piece       23     26-MAY-15          D:\DATA_XE\RMANXE_0VQ7UB17_1_1XE880749607
RMAN> 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.


RMAN> DELETE OBSOLETE; 

RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 0 days
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log          9      26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_19_BP8BD2MV_.ARC
Archive Log          10     26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_20_BP8BFSC1_.ARC
Archive Log          11     26-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_26\O1_MF_1_21_BP90WVBV_.ARC
Backup Set           21     26-MAY-15
  Backup Piece       21     26-MAY-15          D:\DATA_XE\RMANXE_0TQ7UA58_1_1XE880748712291
Backup Set           23     26-MAY-15
  Backup Piece       23     26-MAY-15          D:\DATA_XE\RMANXE_0VQ7UB17_1_1XE880749607311
Backup Set           24     26-MAY-15
  Backup Piece       24     26-MAY-15          D:\DATA_XE\RMANC-2761439438-20150526-08
Backup Set           25     26-MAY-15
  Backup Piece       25     26-MAY-15          D:\DATA_XE\RMANXE_11Q7UBSU_1_1XE880750494331
Backup Set           26     26-MAY-15
  Backup Piece       26     26-MAY-15          D:\DATA_XE\RMANC-2761439438-20150526-09
Archive Log          12     27-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_27\O1_MF_1_22_BPB460PB_.ARC
Archive Log          13     27-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_27\O1_MF_1_23_BPBK37B9_.ARC
Archive Log          14     27-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_27\O1_MF_1_24_BPBO8317_.ARC
Archive Log          15     27-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_27\O1_MF_1_25_BPC22X9S_.ARC
Archive Log          16     27-MAY-15          D:\XE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ARCHIVELOG\2015_05_27\O1_MF_1_26_BPC7MBJB_.ARC
Backup Set           29     27-MAY-15
  Backup Piece       27     27-MAY-15          D:\DATA_XE\RMANXE_15Q80FE4_1_1XE880819652371

Do you really want to delete the above objects (enter YES or NO)? Yes – Press yes to delete all the above backup files.

NOTE: The delete obsolete command also can take parameters to define a recovery window or backup redundancy that is different from the existing policy. If your default recovery window is seven days and you want to remove backups that are five days old, then you could issue this command:


RMAN> DELETE OBSOLETE RECOVERY WINDOW OF 5 DAYS;

RMAN> SHOW RETENTION POLICY;

RMAN configuration parameters are:
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 0 DAYS;

Comments

Popular posts from this blog

ORA-28007: THE PASSWORD CANNOT NE REUSED

             - Here will see how to deal with  => ORA-28007: the password cannot be reused -  I got a request from client user, stating his account has been locked. When I check the status of the account I found the below. connect to SYS user & execute the below query of that database. SQL> select password,username,account_status,profile from dba_users where username='TEST'; PASSWORD               USERNAME   ACCOUNT_STATUS                 PROFILE ------------------             ----------------  -------------------------------           -------------------- AB2Aa8AC9971521e3     TEST       EXPIRED(GRACE)&LOCKED    NONAPP_USERS So, then I have unlocked the account and checked the same again & I found the below results. ...

CHANGING DBID FOR ORACLE DATABASE 11G

C:\Users\computer>sqlplus SQL*Plus: Release 11.1.0.7.0 - Production on Thu Sep 10 21:03:33 2013 Copyright (c) 1982, 2008, Oracle.  All rights reserved. Enter user-name: sys as sysdba Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select dbid from v$database;       DBID ---------- 2188161033 SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options C:\Users\computer>nid DBNEWID: Release 11.1.0.7.0 - Production on Thu Sep 10 21:04:44 2013 Copyright (c) 1982, 2007, Oracle.  All rights reserved. Keyword     Description                    (Default) ---------------------------------------------------- TARGET ...