This discussion is archived
5 Replies Latest reply: May 12, 2012 7:04 AM by mseberg RSS

*HOW TO DELETE THE ARCHIVE LOGS ON THE STANDBY*

user560159 Newbie
Currently Being Moderated
HOW TO DELETE THE ARCHIVE LOGS ON THE STANDBY

I have set the RMAN CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY; on my physical standby server.

My archivelog files are not deleted on standby.

I have set the CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default on the Primary server.

I've checked the archivelogs with the FRA and they are not beign deleted on the STANDBY. Do I have to do something for the configuation to take effect? Like run a RMAN backup?

I've done a lot ofresearch and i'm getting mixed answers. Please help. Thanks in advanced.

J
  • 1. Re: *HOW TO DELETE THE ARCHIVE LOGS ON THE STANDBY*
    mseberg Guru
    Currently Being Moderated
    Setting the Policy will not delete the Archive logs on the Standby. ( I found a thread where the Data Guard product manager says "The deletion policy on both sides will do what you want" ). However I still
    like to clean them off with RMAN.

    I would use RMAN to delete them so that it can use that Policy are you are protected in case of Gap, transport issue etc.

    There are many ways to do this. You can simply run RMAN and have it clean out the Archive.

    Example :
    #!/bin/bash
    #.................................................
    # Name: db_rman_arch_standby.sh 
    # Purpose: Database rman backup
    # Usage : db_rman_arch_standby <DBNAME>
    #..................................................
    # 
    
    if [ "$1" ]
    then DBNAME=$1
    else
    echo "basename $0 : Syntax error : use . db_rman_full <DBNAME> "
    exit 1
    fi
    
    . /u01/app/oracle/dba_tool/env/${DBNAME}.env
    
    
    echo ${DBNAME}
    
    MAILHEADER="Archive_cleanup_on_STANDBY_${DBNAME}"
    
    echo "Starting RMAN..."
    $ORACLE_HOME/bin/rman target / catalog <user>/<password>@<catalog> << EOF
    
    
    delete noprompt ARCHIVELOG UNTIL TIME 'SYSDATE-8';
    
    
    exit
    EOF
    
    
    echo `date`
    #
    echo
    echo 'End of archive cleanup on STANDBY'
    
    mailx -s ${MAILHEADER} $MAILTO < /tmp/rmandbarchstandby.out
    
    
    #
    # End of Script
    This uses ( calls an ENV) so the crontab has an environment.

    Example ( STANDBY.env )
    ORACLE_BASE=/u01/app/oracle
    
    ULIMIT=unlimited
    
    ORACLE_SID=STANDBY
    
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0.2
    
    ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    
    LIBPATH=$LD_LIBRARY_PATH:/usr/lib
    
    TNS_ADMIN=$ORACLE_HOME/network/admin
    
    PATH=$ORACLE_HOME/bin:$ORACLE_BASE/dba_tool/bin:/bin:/usr/bin:/usr/ccs/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/lbin:/GNU/bin/make:/u01/app/oracle/dba_tool/bin:/home/oracle/utils/SCRIPTS:/usr/local/bin:.
    
    
    #export TERM=linux=80x25 wrong wrong wrong wrong wrong
    
    export TERM=vt100
    
    
    export ORACLE_BASE ORACLE_SID ORACLE_TERM ULIMIT
    
    export ORACLE_HOME
    
    export LIBPATH LD_LIBRARY_PATH ORA_NLS33
    
    export TNS_ADMIN
    
    export PATH
    
    export MAILTO=?? your email here
    Note use the env command in Unix to get you settings.

    There are probably ten other/better ways to do this, but this works.

    other options ( you decide )

    Configure RMAN to purge archivelogs after applied on standby [ID 728053.1]

    http://www.oracle.com/technetwork/database/features/availability/rman-dataguard-10g-wp-1-129486.pdf

    Maintenance Of Archivelogs On Standby Databases [ID 464668.1]


    Tip I don't care myself but in some of the other forums people seem to mind if you use all caps in the subject. They say it shouting. My take is if somebody is shouting at me I'm probably going to just move away.

    Best Regards

    mseberg

    Edited by: mseberg on May 8, 2012 11:53 AM

    Edited by: mseberg on May 8, 2012 11:56 AM
  • 2. Re: *HOW TO DELETE THE ARCHIVE LOGS ON THE STANDBY*
    user560159 Newbie
    Currently Being Moderated
    Thank you so much. I will try this when I get back in the office and will then let you know if it worked. Talk to ya soon.

    J
  • 3. Re: *HOW TO DELETE THE ARCHIVE LOGS ON THE STANDBY*
    user560159 Newbie
    Currently Being Moderated
    I will implement your script and test it, however, what should the RMAN settings be for the primary and standby? Can you do a show all? Is this correct? I am so confused what I should set for my RMAN settings. Every document says something different. Currently the primary has two days of archive log kept around and the standby keeps all of them. Thanks in advance.

    On Primary

    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;





    On Standby

    CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;




    Thanks,

    J
  • 4. Re: *HOW TO DELETE THE ARCHIVE LOGS ON THE STANDBY*
    user560159 Newbie
    Currently Being Moderated
    I'm using Oracle 11g with ASM.
  • 5. Re: *HOW TO DELETE THE ARCHIVE LOGS ON THE STANDBY*
    mseberg Guru
    Currently Being Moderated
    Sorry for the delay :

    Should be the other way around at least for the Primary


    On Primary


    CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;


    On Standby ( Depends upon where backup is preformed )


    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;

    Or

    CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY; ( if Standby Where Backups Are Not Performed )

    Source

    Data Guard Concepts and Administration 11g Release 2 (11.2) E10700-02

    11.3.2 RMAN Configurations at the Primary Database

    3. Specify when archived logs can be deleted with the CONFIGURE ARCHIVELOG
    DELETION POLICY command


    What I use


    Backups Occur on Primary


    On Primary

    CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;



    On Standby

    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;







    Best Regards

    mseberg

    Edited by: mseberg on May 11, 2012 3:14 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points