Solved

what is the syntax for deleting archivelogs after successful backup

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

777 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