How to delete archived log files past one week in RMAN - Page 2
DBAsupport.com Forums - Powered by vBulletin
Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: How to delete archived log files past one week in RMAN

  1. #11
    Join Date
    Dec 2001
    Location
    USA
    Posts
    620
    Hi FARRUKH,

    This is what I was looking for but I got foll. errors.

    rmandel.rcv
    --------------
    run {
    allocate channel d1 for delete type disk;
    change archivelog until time 'SYSDATE-1' delete;
    release channel d1;
    resync catalog;
    }

    RMAN-00558: error encountered while parsing input commands
    RMAN-01005: syntax error: found "for": expecting one of: "name, type"
    RMAN-01007: at line 2 column 21 file: rmandel.rcv

    Also, can I call rmandel.rcv from another RMAN .rcv file?

    Thanks,
    Sam
    ------------------------
    To handle yourself, use your head. To handle others, use your heart

  2. #12
    Join Date
    Feb 2001
    Posts
    41

    Wink

    Hi Sam,

    You don't have to put "d1" after allocate channel, just do the following:

    run {
    allocate channel for delete type disk;
    change archivelog until time 'SYSDATE-7' delete;
    release channel;
    }

    Yes, you can do it from .rcv file as well. Please let me know if you need more information!

    Cheers!!
    Farrukh
    Last edited by FARRUKH; 01-14-2003 at 04:22 PM.

  3. #13
    Join Date
    May 2002
    Location
    California, USA
    Posts
    175

    Smile

    You can also use:

    allocate channel for maintenance type disk;
    crosscheck backup of archivedlogs completed between 'sysdate - 30' and 'sysdate - 7';
    delete expired backup;
    release channel;
    exit;

    In 8i, that still has be run from RMAN> command prompt. In 9i, you can do it from script.


    Hope that helps,

    clio_usa - OCP 8/8i/9i DBA

    Visit our Web Site

  4. #14
    Join Date
    Feb 2001
    Posts
    41

    Cool

    In 8i, that still has be run from RMAN> command prompt. In 9i, you can do it from script
    Hi clio_usa,

    In 8i, you can also do it from script as well.

    Cheers!
    Farrukh

  5. #15
    Join Date
    May 2002
    Location
    California, USA
    Posts
    175

    Smile

    Have you actually tried? I did, and it's the way as Oracle says:

    Purpose
    To determine whether backups stored on disk or tape exist. Backups are either backup sets or media-managed proxy copies.

    The crosscheck command checks only backup sets marked AVAILABLE or EXPIRED, either by examining the backup pieces on disk when the channel is type disk, or by querying the media manager when the channel is type 'sbt_tape'. It only processes backups created on the specified channel.

    RMAN does not delete any backup pieces that it is unable to find, but updates their repository records to EXPIRED status. If some backup pieces were erroneously marked as EXPIRED, for example, because the media manager was misconfigured, then after ensuring that the files really do exist in the media manager, run the crosscheck backup command again to restore those files to AVAILABLE status.

    See Also:
    "Maintaining the RMAN Repository".




    Requirements
    Execute crosscheck backup only at the RMAN prompt.

    Allocate a maintenance channel before issuing crosscheck backup.
    For refernce: CROSSCHECK RMAN's command


    Hope that helps,

    clio_usa - OCP 8/8i/9i DBA

    Visit our Web Site

  6. #16
    Join Date
    Feb 2001
    Posts
    41

    Smile

    Hi clio_usa,

    Thanks for the info!

    Cheers!
    Farrukh

  7. #17
    Join Date
    Dec 2001
    Location
    USA
    Posts
    620
    Hi Farrukh,

    You don't have to put "d1" after allocate channel, just do the following:
    run {
    allocate channel for delete type disk;
    change archivelog until time 'SYSDATE-7' delete;
    release channel;
    }
    I get foll. error if I do not give channel id.

    RMANN> run {
    allocate channel for delete type disk;

    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01005: syntax error: found "for": expecting one of: "channel_id, double-quoted-string, identifier, single-quoted-string"
    RMAN-01007: at line 2 column 18 file: standard input

    Thanks,
    Sam
    ------------------------
    To handle yourself, use your head. To handle others, use your heart

  8. #18
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  9. #19
    Join Date
    Feb 2001
    Posts
    41

    Thumbs up

    Hi Sam,

    Here is my script. I don't know which OS are you using?

    $ cat /u01/scripts/cleanup_rman_arch_test2.sh
    #!/bin/ksh
    ORACLE_SID=TEST2; export ORACLE_SID
    ORACLE_HOME=/u01/oracle8i/product/8.1.7; export ORACLE_HOME
    PATH=$ORACLE_HOME/bin; export PATH
    $ORACLE_HOME/bin/rman target username/password@TEST2 catalog rman/rman@rcat log=/u01/logs/cleanup_rman_arch_test2_log @/u01/scripts/cleanup_rman_arch_test2.rcv
    exit

    $ cat /u01/scripts/cleanup_rman_arch_test2.rcv
    allocate channel for delete type disk;
    change archivelog until time 'SYSDATE-7' delete;
    release channel;

    Cheers!
    Farrukh

  10. #20
    Join Date
    Dec 2001
    Location
    USA
    Posts
    620
    Hi Farrukh,

    Finally foll. script worked.

    run {
    allocate channel d1 type disk;
    sql 'alter system archive log current';
    backup
    format 'e:\backup\%d_%s_%p_%t.1al'
    archivelog all;
    release channel d1;
    resync catalog;
    }
    allocate channel for maintenance type disk;
    change archivelog until time 'sysdate-1' delete;

    Thanks everybody.
    Sam
    ------------------------
    To handle yourself, use your head. To handle others, use your heart

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width