Thursday 29 March 2012

Maintenance Of Archivelogs On Standby Databases

Maintenance Of Archivelogs On Standby Databases



Maintenance of archivelogs which are already applied on standby database in Oracle 10g and above From Oracle 10g onwards, RMAN has a specific configuration for archivelog deletion policy i.e. ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY

This parameter can be set on primary and standby databases.  To enable automatic maintenance of the archivelogs on standby perform the below steps on standby database :
In a dataguard configuration, the archivelogs from the FRA will be automatically purged when the following conditions are met by the database. If you need it purged in at the Primary site, set it on Primary database.


Step1:
prior to 11g, if not using mandatory archivelog destinations, the database (primary and standby) must be restarted with the following parameter:       
SQL> alter system set "_log_deletion_policy"='ALL' scope=spfile;


Step 2 :
Enable the flash recovery area on the standby database so that all the archivelogs are shipped in the flash recovery area.

Example : 
To enable Flash Recovery Area and to allow the archivelogs to be shipped to Flash Recovery Area set the below parameters
SQL> alter system set DB_RECOVERY_FILE_DEST='/disk1/FRA';
SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=80G;
SQL> alter system set  LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';


Step 3 :
Set the parameter Archive log deletion policy to applied on standby

Example :
RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;

Note : With the above settings whenever there is a space pressure in Flash Recovery Area all the archivelogs that are applied on standby database will be automatically deleted.  
To list the obsolete objects, run the following query:
RMAN> SHOW RETENTION POLICY
RMAN> REPORT OBSOLETE;


Step 4:
there is space pressure in the FRA
When an archivelog is automatically deleted from the FRA, you will see this in the database's alert.log:
Sat Jun 18 01:00:32 2011
Deleted Oracle managed file /opt/app/oracle/FRA/ORA102/archivelog/2011_05_30/o1_mf_1_151_6y71q675_.arc
Deleted Oracle managed file /opt/app/oracle/FRA/ORA102/archivelog/2011_05_31/o1_mf_1_151_6y87pzg4_.arc

4 comments:

  1. hi Arpit ...

    Info seems very interested..but can u please put some light on FRA..what is it..is it something different from the archivelog destination to which archives are being shipped from primary to standby??
    Thnx..

    ReplyDelete
    Replies
    1. Hi,FRA stand for flashback recover area which is new feature introuced in Oracle 10g. It's a very intresting feature , more details can be found on below link. Please shoot if any other questions.

      http://docs.oracle.com/cd/B19306_01/backup.102/b14192/setup005.htm

      Delete
  2. I think FRA is now called as FAST RECOVERY AREA(Oracle chaged it from Flash to Fast). No big deal.

    ReplyDelete
  3. Hello,

    Just confirming my understanding. If i set below parameter in the rman of the standby database(which is in mount state), it will
    only the delete the archives from standby server(LOG_ARCHIVE_DEST_2).

    It will not effect the archives on primary server (LOG_ARCHIVE_DEST_1).

    RMAN>CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;


    Thanks & Regards,
    Deepak Jha

    ReplyDelete