Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Wednesday, 22 August 2012

Deleting RMAN Backups

You can use RMAN to delete backups created with RMAN. Deleting backups using RMAN both deletes the specified backups and updates the RMAN repository to reflect the deletion.
Note: Backups with DELETED status do not appear in the LIST command output. You can, however, query V$ control file views to get information about deleted backups.

Deleting Specified Backups:

Deleting backups using primary keys from LIST output:
DELETE BACKUPPIECE 101;
Deleting backups by filename on disk:
DELETE CONTROLFILECOPY '/tmp/control01.ctl';
Deleting archived redo logs from disk:
DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 300;
Deleting backups based on tags:
DELETE BACKUP TAG='before_upgrade';
Delete backups based on the objects backed up and the media or disk location where the backup is stored:
DELETE BACKUP OF TABLESPACE users DEVICE TYPE sbt; # delete only from tape
DELETE COPY OF CONTROLFILE LIKE '/tmp/%';
Delete all backups for this database recorded in the RMAN repository:
DELETE BACKUP; 
Delete backups and archived redo logs from disk based on whether they are backed up on tape:
DELETE ARCHIVELOG ALL BACKED UP 3 TIMES TO sbt; 
If you run RMAN interactively, then RMAN asks for confirmation before deleting any files. You can suppress these confirmations by using the NOPROMPT keyword with any form of the BACKUP command:
     DELETE NOPROMPT ARCHIVELOG ALL; 

Deleting Expired RMAN Backups after CROSSCHECK

When the CROSSCHECK command is used to determine whether backups recorded in the repository still exist on disk or tape, if RMAN cannot locate the backups, then it updates their records in the RMAN repository to EXPIRED status. You can then use the DELETE EXPIRED command to remove records of expired backups from the RMAN repository. If the expired files still exist, then the DELETE EXPIRED command terminates with an error.
1.       If you have not performed a crosscheck recently, then issue a CROSSCHECK command. For example, issue:
         CROSSCHECK BACKUP;
2.       Delete the expired backups. For example, issue:
         DELETE EXPIRED BACKUP;
Note: The DELETE EXPIRED command issues warnings if any objects marked as EXPIRED actually exist. In rare cases, the repository can mark an object as EXPIRED even though the object exists. For example, a directory containing an object is corrupted at the time of the crosscheck, but is later repaired, or the media manager was not configured properly and reported some backups as not existing when they really existed.

Using DELETE FORCE With RMAN Backups

It is possible for the RMAN repository to indicate that an object has one status while the actual status of the object on the media is different. For example, the RMAN repository says that a backup set is AVAILABLE when it is in fact no longer present on disk or tape (or missing from the media manager's catalog of the contents of tapes or other backup media). If you attempt to delete the object, then you receive a warning such as the following:
RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208:to mismatched status.  Use CROSSCHECK command to fix status
List of Mismatched objects
==========================
Object Type   Filename/Handle
--------------- ---------------------------------------------------
Backup Piece    0id270ud_1_1
If you use the DELETE command with the optional FORCE keyword, RMAN deletes the specified backups, but ignores any I/O errors, including those that occur when a backup is missing from disk or tape. It then updates the RMAN repository to reflect the fact that the backup is deleted, regardless of whether RMAN was able to delete the file or whether the file was already missing. For example:
 DELETE FORCE NOPROMPT BACKUPSET TAG 'weekly_bkup';

Deleting Obsolete RMAN Backups Based on Retention Policies

DELETE OBSOLETE;
You can also use the REDUNDANCY or RECOVERY WINDOW clauses with DELETE to delete backups obsolete under a specific retention policy instead of the configured default:
DELETE OBSOLETE REDUNDANCY = 3;
DELETE OBSOLETE RECOVERY WINDOW OF 7 DAYS;

DELETE OBSOLETE Behavior When KEEP UNTIL Time Expires

DELETE OBSOLETE does not delete backups required to satisfy the specified retention policy, even if some backups have KEEP UNTIL times set which have passed to override the retention policy.
The KEEP UNTIL clause never causes RMAN to consider a backup obsolete, if the backup is still required to satisfy the retention policy. KEEP UNTIL can cause backups to be kept longer than the retention policy requires, but never causes a backup to become obsolete sooner than the retention policy requires.
Backups are never obsolete if they are still needed to meet the retention policy, regardless of any KEEP UNTIL time. With a recovery window-based retention policy, even if the specified KEEP UNTIL time has expired, the backup is retained if the backup is needed to satisfy the recovery window. With a redundancy-based retention policy, even if the specified KEEP UNTIL time has expired, the backup is retained as long as it is required to satisfy the redundancy requirement.
Delete Archive log
Rman>Delete Archivelog all;

0 comments:

Post a Comment