Solved

what is the syntax for deleting archivelogs after successful backup

Posted on 2014-03-14
5
2,369 Views
Last Modified: 2014-03-14
I have a bash script that backups a database and the archivelogs. However, I would like the script to delete the archivelogs after they have been successfully backed up. I hav  done it in OEM. But now a script is being used.

script contents:
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=niced

$ORACLE_HOME/bin/rman TARGET / LOG /u01/app/oracle/scripts/backups/logs/niced_fullbkp.sh-$ORACLE_SID-'date '+%m%d%y-%H%M%S''.log <<EOF
run{
allocate channel c1 device type disk format '/backups/full_%U';
allocate channel c2 device type disk format '/backups/full_%U';
allocate channel c3 device type disk format '/backups/full_%U';
allocate channel c4 device type disk format '/backups/full_%U';
allocate channel c5 device type disk format '/backups/full_%U';
allocate channel c6 device type disk format '/backups/full_%U';
allocate channel c7 device type disk format '/backups/full_%U';
allocate channel c8 device type disk format '/backups/full_%U';
backup database plus archivelog;
}
exit
EOF
0
Comment
Question by:sikyala
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 167 total points
ID: 39929637
you can delete logs with rman command "DELETE ARCHIVELOG"
you can specify "until" clauses by sequence or date

for example...

DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 1234;

DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE - 14';  -- older than 2 weeks

or simply

DELETE NOPROMPT ARCHIVELOG ALL;

you can also supply other conditions based on backups or apply policies
for more information ...

http://docs.oracle.com/cd/E11882_01/backup.112/e10643/rcmsynta016.htm#RCMRF121
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 167 total points
ID: 39929638
backup database plus archivelog delete input;

OR

backup database plus archivelog delete all input;

With DELETE INPUT, RMAN only deletes the specific copy of the archived redo log chosen for the backup set. With DELETE ALL INPUT, RMAN will delete each backed-up archived redo log file from all log archiving destinations.
Quote from here: http://docs.oracle.com/cd/B19306_01/backup.102/b14192/bkup003.htm#i1006454
0
 
LVL 29

Assisted Solution

by:MikeOM_DBA
MikeOM_DBA earned 166 total points
ID: 39929641
You can configure it (one time is enough) using an option similar to these:
CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO STANDBY;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DEVICE TYPE DISK;

Open in new window

0
 

Author Comment

by:sikyala
ID: 39929664
awesome thanks
0
 

Author Closing Comment

by:sikyala
ID: 39929672
thanks
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix process listing into CSV format 3 83
plsql job on oracle 18 104
UM7 Stop Sending packets with GPS Sensor 1 39
Zimbra and Renewing SSL Certficate 9 53
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question