Solved

what is the syntax for deleting archivelogs after successful backup

Posted on 2014-03-14
5
2,145 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

707 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

12 Experts available now in Live!

Get 1:1 Help Now