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:
- RESTORE DATABASE VALIDATE vs RESTORE ARCHIVE VALIDATE
- ORA-01113: file n needs media recovery – ORA-01110: data file n: \SYSTEM01.dbf′
- How to put oracle database to archivelog
- 15 Oracle Exp Command Examples to Export Database Objects
- Useful sql scripts for Oracle DBA
Excuse, that I interfere, but, in my opinion, there is other way of the decision of a question.
It is removed (has mixed topic)