Wednesday, May 21, 2025

Recovery Window and Redundancy in RMAN

In Oracle RMAN (Recovery Manager), the recovery window is a key concept used to define your backup retention policy. It specifies the period of time (in days) for which you want to be able to recover your database to any point in time. RMAN uses this window to determine which backups and archived logs to retain and which can be deleted.



What is the Recovery Window?


The recovery window is the number of days into the past that you want your database to be recoverable.

For example, if you set a recovery window of 7 days, RMAN will keep all backups and archived logs needed to restore and recover the database to any point within the last 7 days.


How Recovery Window Works?


RMAN considers a backup as obsolete if it is no longer needed to satisfy the recovery window.

When you run DELETE OBSOLETE, RMAN removes backups and archived logs that are outside the recovery window.


Setting the Recovery Window

You set the recovery window using the CONFIGURE RETENTION POLICY command:


This tells RMAN to retain all backups and archived logs required for point-in-time recovery within the last 7 days.


Example Scenario

Suppose today is May 21, and you set a recovery window of 7 days.


RMAN will keep all backups and archived logs needed to recover the database to any point between May 14 and May 21.

Any backups or logs older than May 14 that are not needed for recovery within this window are considered obsolete.


Checking the Retention Policy

You can check your current retention policy with:

RMAN> SHOW RETENTION POLICY;


Deleting Obsolete Backups

To remove backups and archived logs that are outside the recovery window, use:

RMAN> DELETE OBSOLETE;


Recovery Window vs. Redundancy


Recovery Window: Retains backups based on time (e.g., last 7 days).

Redundancy: Retains a specific number of backup copies (e.g., last 2 backups).

You can only have one retention policy active at a time (either recovery window or redundancy).


Best Practices

Set the recovery window based on your business requirements for point-in-time recovery.

Regularly run DELETE OBSOLETE to free up storage.

Monitor backup and recovery operations to ensure compliance with your retention policy.


Multiple ways to connect with rman - Oracle database

Multiple ways to connect with rman to oracle database 


1->

[oracle@orcl dbs]$

[oracle@orcl dbs]$

[oracle@orcl dbs]$ rman target "' / as sysdba'"


Recovery Manager: Release 19.0.0.0.0 - Production on Wed May 21 11:38:04 2025

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database: DB1 (DBID=1788905834)


RMAN>


2->


[oracle@orcl dbs]$

[oracle@orcl dbs]$

[oracle@orcl dbs]$ rman target /


Recovery Manager: Release 19.0.0.0.0 - Production on Wed May 21 11:38:26 2025

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database: DB1 (DBID=1788905834)


RMAN>



3->


[oracle@orcl dbs]$

[oracle@orcl dbs]$

[oracle@orcl dbs]$ rman target /


Recovery Manager: Release 19.0.0.0.0 - Production on Wed May 21 11:38:26 2025

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database: DB1 (DBID=1788905834)


RMAN>



4->


[oracle@orcl dbs]$

[oracle@orcl dbs]$

[oracle@orcl dbs]$ rman target sys/sys


Recovery Manager: Release 19.0.0.0.0 - Production on Wed May 21 11:42:47 2025

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database: DB1 (DBID=1788905834)


RMAN>


RMAN>


How to configure the size of Fast Recovery Area (FRA) in Oracle database ?

Configure the size of FRA 

 


SQL>

SQL>

SQL> show parameter db_recovery


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_

                                                 area

db_recovery_file_dest_size           big integer 12732M

SQL>

SQL>

SQL> alter system set db_recovery_file_dest_size=12G scope=both ;


System altered.


SQL> show parameter db_recovery_file_dest_size;


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest_size           big integer 12G

SQL>

How to add a redo log member to an existing redo log group in an Oracle database | Redo log files Multiplexed

Add a redo log member to an existing redo log group in an Oracle database


SQL> select group#,status,member from v$logfile;


    GROUP# STATUS

---------- -------

MEMBER

--------------------------------------------------------------------------------

         3

/u01/app/oracle/oradata/DB1/redo03.log


         2

/u01/app/oracle/oradata/DB1/redo02.log


         1

/u01/app/oracle/oradata/DB1/redo01.log



SQL>

SQL> select group#,members,archived,status from v$log;


    GROUP#    MEMBERS ARC STATUS

---------- ---------- --- ----------------

         1          1 NO  CURRENT

         2          1 YES INACTIVE

         3          1 YES INACTIVE


SQL>

SQL> alter database add logfile member '/u01/app/oracle/oradata/DB1/redo01b.log' to group 1;


Database altered.


SQL> select member from v$logfile;


MEMBER

--------------------------------------------------------------------------------

/u01/app/oracle/oradata/DB1/redo03.log

/u01/app/oracle/oradata/DB1/redo02.log

/u01/app/oracle/oradata/DB1/redo01.log

/u01/app/oracle/oradata/DB1/redo01b.log





SQL> 



Best Practices & Notes


Always add members on different disks for redundancy.

The new log file must not exist already on disk.

All members of a group are written to simultaneously — they are identical.

Adding a member does not affect the database availability.