Skip Headers
Oracle® Database Backup and Recovery Reference
10g Release 2 (10.2)

Part Number B14194-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

DELETE

Syntax

delete::=

Description of delete.gif follows
Description of the illustration delete.gif

maintSpec::=

Description of maintspec.gif follows
Description of the illustration maintspec.gif

Purpose

To delete physical backups and copies as well as do the following:

When running RMAN interactively, DELETE displays a list of the files and prompts you for confirmation before deleting any file in the list. When reading commands from a command file, RMAN will not prompt for confirmation.

Relationship Between Repository and Media

The repository record for a backup can sometimes fail to reflect the physical status of the backup. For example, files backed up to disk can be deleted using an operating system utility. The record in the RMAN repository is not updated by the operating system utility, so the RMAN repository still shows the object as available even though it has been deleted. If you do not run the CROSSCHECK command to update the repository, and if you then run DELETE against the backup, then the repository shows that the object is AVAILABLE while the object is in fact missing. The following table indicates the behavior of DELETE in such situations.

Repository Status Physical Status Behavior of DELETE Command
AVAILABLE Not found on media Does not delete the object and reports the list of mismatched objects at the end of the job. RMAN does not update the repository status.
EXPIRED Found on media Does not delete the object and reports the list of mismatched objects at the end of the job. RMAN does not update the repository status.
UNAVAILABLE Any Removes repository record and deletes object if it exists. All I/O errors are ignored.
FORCE Any Removes repository record and deletes object if it exists. All I/O errors are ignored. RMAN displays the number of objects deleted at the end of the job.

See Also:

"BACKUP" to learn about the BACKUP ... DELETE INPUT command

Restrictions and Usage Notes

Keywords and Parameters

Syntax Element Description
FORCE Deletes specified files (whether or not they exist on the media) and removes repository records. RMAN ignores any I/O errors for the deleted objects. RMAN displays the number of deleted objects at the end of the job.
NOPROMPT Deletes specified files without first listing the files or prompting for confirmation. The DELETE NOPROMPT command still displays each item as it is deleted.

By default, DELETE displays a list of files to be deleted and prompts for confirmation. If the user confirms, then RMAN shows each item as it is deleted. If you are running commands from a command file, then NOPROMPT is the default.

EXPIRED Removes only files whose status in the repository is EXPIRED. RMAN marks backups and copies as expired when you run a CROSSCHECK command and the files are absent or inaccessible. To determine which files are expired, run a LIST EXPIRED command.

If for some reason a backup or copy marked EXPIRED exists when you run the DELETE EXPIRED command, then RMAN deletes the physical files.

maintSpec Deletes files output by the BACKUP command. For maintSpec options, refer to the parameter descriptions in "maintSpec".
OBSOLETE Deletes backups and datafile copies recorded in the RMAN repository that are obsolete, that is, no longer needed. In addition to obsolete datafile backups, RMAN deletes obsolete archived logs and archived log backups. RMAN determines which backups and copies of datafiles are no longer needed, which in turn determines when logs (and backups of logs) are no longer needed. RMAN considers the creation of a datafile as a backup when deciding which logs to keep.

RMAN first uses the options that you specify with obsOperandList to determine what is obsolete. If you do not specify options in obsOperandList, then RMAN uses the options specified in CONFIGURE RETENTION POLICY.

Note: Even if you use a KEEP UNTIL clause to specify a time after which a backup is to be considered obsolete, RMAN does not consider that backup obsolete if it is needed to satisfy the specified retention policy. A KEEP UNTIL clause can cause a backup to be kept longer than the retention policy requires, but never a shorter time.

obsOperandList Specifies the criteria for determining which backups and copies are obsolete.

See Also: "obsOperandList"

DEVICE TYPE deviceSpecifier Restricts the deletion to obsolete backups and copies created on the specified device type only.

See Also: "deviceSpecifier"


Examples

Deleting Expired Backups: Example The following example uses a configured sbt channel to check the media manager for expired backups of the tablespace users that are more than one month old and removes their catalog records:

CROSSCHECK BACKUPSET OF TABLESPACE users 
  DEVICE TYPE sbt COMPLETED BEFORE 'SYSDATE-31';
DELETE NOPROMPT EXPIRED BACKUPSET OF TABLESPACE users 
  DEVICE TYPE sbt COMPLETED BEFORE 'SYSDATE-31';

Deleting Obsolete Backups: Example The following example deletes backups and copies that are not needed to recover the database to a random point within the last week. RMAN also deletes archived redo logs that are no longer needed:

DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;

Deleting Files That Have Already Been Backed Up: Example The following example deletes backups and copies (including archived redo logs) that have already been backed up at least twice to tape:

DELETE NOPROMPT BACKUP BACKED UP 2 TIMES TO DEVICE TYPE sbt;
DELETE NOPROMPT COPY BACKED UP 2 TIMES TO DEVICE TYPE sbt;

Forcing the Deletion of a Backup Set: Example The following example attempts to delete the backup set copy with tag weekly_bkup:

DELETE NOPROMPT BACKUPSET TAG weekly_bkup;

However, RMAN displays a warning because the repository shows the backup set as available, but the object is not actually available on the media:

RMAN-06207: WARNING: 1 objects could not be deleted for SBT_TAPE 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

The following command forces RMAN to delete the backup set:

DELETE FORCE NOPROMPT BACKUPSET TAG weekly_bkup;