Guys, I would like to share with you all a scenario which you may come across very seldom, but really important.
RMAN is not deleting ArchiveLogs on Primary Database when the State for the Archive Destination to the Standby Database has already been set to 'defer'. When you are trying to delete archive logs, the below error is raised:
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
As long as the Archive Destination (log_archive_dest_2) is still set, we consider the Standby Database as still alive and keep the ArchiveLogs on Primary Database to perform Gap Resolution when the Archive Destination is valid again.
There are Situations when this is not wanted, eg :
The Standby Database was activated or removed, but you still keep the Archive Destination because you want to rebuild the Standby Database later again. In this Case you can set the hidden Parameter "_deferred_log_dest_is_valid" to FALSE (the default is TRUE) which will consider the deferred Archive Destinations as completely unavailable and will not preserve ArchiveLogs for those Destinations any more. It is a dynamic Parameter and can be set as shown below :
SQL> alter system set "_deferred_log_dest_is_valid" = FALSE scope=both;
I prefer to do this than deleting the archive logs forcefully.
Just remember to enable this parameter once you re-build your Standby, to avoid unintentional deletions ... you know what I mean 😉
RMAN is not deleting ArchiveLogs on Primary Database when the State for the Archive Destination to the Standby Database has already been set to 'defer'. When you are trying to delete archive logs, the below error is raised:
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
As long as the Archive Destination (log_archive_dest_2) is still set, we consider the Standby Database as still alive and keep the ArchiveLogs on Primary Database to perform Gap Resolution when the Archive Destination is valid again.
There are Situations when this is not wanted, eg :
The Standby Database was activated or removed, but you still keep the Archive Destination because you want to rebuild the Standby Database later again. In this Case you can set the hidden Parameter "_deferred_log_dest_is_valid" to FALSE (the default is TRUE) which will consider the deferred Archive Destinations as completely unavailable and will not preserve ArchiveLogs for those Destinations any more. It is a dynamic Parameter and can be set as shown below :
SQL> alter system set "_deferred_log_dest_is_valid" = FALSE scope=both;
I prefer to do this than deleting the archive logs forcefully.
Just remember to enable this parameter once you re-build your Standby, to avoid unintentional deletions ... you know what I mean 😉