Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

what is the syntax for deleting archivelogs after successful backup

Posted on 2014-03-14
5
Medium Priority
?
2,688 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 668 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 668 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 664 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

618 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