How To Delete Specific Archivelogs and Backups Using RMAN

0
(0)

As part of the regular backup file log maintenance, the recovery window and redundancy commands are usually used within backup scripts to define how long the RMAN backups would stay on disk or on tape.

For archive log retention, the DELETE ARCHIVELOG command is utilized.

DELETE Archive Logs using RMAN

To clean-up older archives the “backup archivelog delete input” is very commonly used to manage the archive log retention on disk.

This however has a very serious drawback because as soon as the backup is finished all the archive logs are purged.

In this scenario if recovery is required then the backup of the archive from tape has to be restored and then they can be applied. This increases the downtime due to the slower recovery rate from tape.

Also for environments that extract data from archive logs, immediate purging of these log files could interfere with processes like Golden Gate and Streams, in case these processes are down for some reason and the backup job fires, it will remove the archive logs that will be required on the process start-up.

Thus to retain these archive logs for a longer time the following can used in the RMAN backup script to manage the archive logs on disk.

RMAN>DELETE ARCHIVELOG ALL COMPLETED BEFORE ‘sysdate-1’;
RMAN>DELETE ARCHIVELOG ALL BACKED UP 2 TIMES to disk;
RMAN>DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 3790;
RMAN> delete noprompt archivelog until time ‘SYSDATE-10’;

Oracle does not allow deleting of older archive, the workaround is to use the “FORCE” keyword if we are sure that we no longer need those archives.

RMAN> DELETE FORCE ARCHIVELOG ALL BACKED UP 2 TIMES to disk;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=72 device type=DISK
List of Archived Log Copies for database with db_unique_name SAN_HA01
=========================================
Key Thrd Seq S Low Time
——- —- ——- – ——————–
1195 1 533 A 25-APR-2013 11:46:48
Name: /oradata/oltp/ps3arc_533.arc

1196 1 534 A 25-APR-2013 11:48:20
Name: /oradata/oltp/ps3arc_534.arc

….
….

Do you really want to delete the above objects (enter YES or NO)? yes

deleted archived log
archived log file name=/oradata/oltp/ps3arc_533.arc RECID=1195 STAMP=813671303
deleted archived log
archived log file name=/oradata/oltp/ps3arc_534.arc RECID=1196 STAMP=813671412
deleted archived log
….
….
Deleted 39 objects

Delete Archivelog Backups

The following command can be used to manage the backup of the archive log when storage space needs to be released.

RMAN>DELETE BACKUP OF archivelog UNTIL TIME=’sysdate-5′;

Obsolete database backups

Backups that fall outside the specified recovery window can be purged using the obsolete command

RMAN>DELETE OBSOLETE RECOVERY WINDOW OF 4 DAYS;

Similar Posts:

20,252

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

2 thoughts on “How To Delete Specific Archivelogs and Backups Using RMAN”

Comments are closed.

Scroll to Top