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

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

  1. #1
    Join Date
    Dec 2001
    Location
    USA
    Posts
    620

    How to delete archived log files past one week in RMAN

    Hi All,

    In RMAN backup script, Once it takes the backup of all Archivelogs, I want to delete archive logs from the server disk, which are older than 7 days.

    I know of command 'delete input'. But, this deletes all the files.

    Is there any command like 'delete input sysdate-7' or something which serves my purpose?

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

  2. #2
    Join Date
    Nov 2000
    Posts
    440
    Check the september's dba tips of the month at



    It show how to delete old archive log file from the os automaticalyhttp://www.quest-pipelines.com/pipel....htm#september

  3. #3
    Join Date
    Feb 2001
    Location
    UAE
    Posts
    304

    Thumbs up

    Thanks Steeve. Thats really cool article....
    Agasimani
    OCP(10g/9i/8i/8)

  4. #4
    Join Date
    Dec 2001
    Location
    USA
    Posts
    620
    Hi Steve,

    Thanks but I need something which can delete from within the RMAN script. Something like 'delete input SYSDATE-n'.

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

  5. #5
    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."

  6. #6
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588
    From the docs, this might help you

    Specifying Records by Time: Example This example backs up all logs that could be used to recover to a point one week ago, and then deletes all archived redo logs that were created more than two weeks ago:

    BACKUP ARCHIVELOG UNTIL TIME 'SYSDATE-7';
    DELETE COPY OF ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-14';

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

    Here, what I want is to backup all the current Archive logs available on the server but delete only those which are older than 7 days.

    So, is there a command similar to

    BACKUP ARCHIVELOG ALL;
    DELETE COPY OF ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';

    Will it work for me?

    Also, pl. tell me how you guys have inserted goody pictures below your names.

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

  8. #8
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Originally posted by samdba

    BACKUP ARCHIVELOG ALL;
    DELETE COPY OF ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
    Why don't you give it a try and report back to us.
    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. #9
    Join Date
    Dec 2001
    Location
    USA
    Posts
    620
    Hi Marist,

    Thanks for your advise. I get the syntax error while using above statement.

    'syntax error: Found copy expecting one of: "input" at line...'

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

  10. #10
    Join Date
    Feb 2001
    Posts
    41

    Wink

    Hi Sam,

    Here is the command which I am using to delete archive logs from the RMAN script:

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


    Cheers!
    Farrukh

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