Solved

what is the syntax for deleting archivelogs after successful backup

Posted on 2014-03-14
5
2,195 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
5 Comments
 
LVL 73

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now