CROSSCHECK

Purpose

Use the CROSSCHECK command to synchronize the physical reality of backups and copies with their logical records in the RMAN repository.

See Also:

Oracle Database Backup and Recovery User's Guide to learn how to manage database records in the recovery catalog

Prerequisites

RMAN must be connected to a target database instance, which must be started.

A maintenance channel is not required for a disk cross-check. If you use a media manager and have not configured automatic channels for it, then you must use run ALLOCATE CHANNEL FOR MAINTENANCE before CROSSCHECK. For example, if you created a backup on an SBT channel, but have not configured automatic SBT channels for this device, then you must manually allocate an SBT channel before CROSSCHECK can check the backup. Furthermore, if you performed backups with different media manager options (pools, servers, libraries, and so on), then you must allocate maintenance channels for each combination.

CROSSCHECK validates all specified backups and copies, even if they were created in previous database incarnations.

Usage Notes

RMAN always maintains metadata about backups in the control file of every target database on which it performs operations. If you use RMAN with a recovery catalog, then RMAN also maintains the metadata from every registered database in the recovery catalog.

If a backup is on disk, then CROSSCHECK determines whether the header of the file is valid. If a backup is on tape, then RMAN queries the RMAN repository for the names and locations of the backup pieces to be checked. RMAN sends this metadata to the target database server, which queries the media management software about the backups. The media management software then checks its media catalog and reports back to the server with the status of the backups.

EXPIRED and AVAILABLE Status

You can view the status of backup sets and copies recorded in the RMAN repository through LIST, V$ views, or recovery catalog views (if you use RMAN with a catalog). Table 2-4 describes the meaning of each status.

The CROSSCHECK command only processes files created on the same device type as the channels used for the cross-check. The CROSSCHECK command checks only objects marked AVAILABLE or EXPIRED in the repository by examining the files on disk for DISK channels or by querying the media manager for sbt channels.

Table 2-4 Meaning of CROSSCHECK Status

Status Description

EXPIRED

Object is not found either in file system (for DISK) or in the media manager (for sbt). A backup set is EXPIRED if any backup piece in the set is EXPIRED.

The CROSSCHECK command does not delete the repository records of files that it does not find, but updates their repository records to EXPIRED. You can run DELETE EXPIRED to remove the repository records for expired files and any existing physical files whose status is EXPIRED.

If backups are EXPIRED, then you can reexecute the cross-check later and determine whether expired backups are available. This precaution is especially useful when you use RMAN with a media manager. For example, if some backup pieces or copies were erroneously marked as EXPIRED because the PARMS channel settings were incorrect, then after ensuring that the files really do exist in the media manager, run the CROSSCHECK BACKUP command again to restore those files to AVAILABLE status.

AVAILABLE

Object is available for use by RMAN. For a backup set to be AVAILABLE, all backup pieces in the set must have the status AVAILABLE.


Cross-Checks in a Data Guard Environment

"RMAN Backups in a Data Guard Environment" explains the difference between the association and accessibility of a backup. In a Data Guard environment, the database that creates a backup or copy is associated with the file. You can use maintenance commands such as CHANGE, DELETE, and CROSSCHECK for backups when connected to any database in the Data Guard environment if the backups are accessible. In general, RMAN considers tape backups created on any database as accessible to all databases in the environment, whereas disk backups are accessible only to the database that created them.

RMAN can only update the status of a backup from AVAILABLE to EXPIRED or DELETED when connected as TARGET to the database associated with the backup. If RMAN cannot delete a backup because it is not associated with the target database, then RMAN prompts you to perform the same CROSSCHECK operation for the file at the database with which it is associated. In this way RMAN protects against unwanted status changes that result from incorrect SBT configurations.

For example, assume that you connect RMAN as TARGET to standby database standby1 and back it up to tape. If the backup is manually removed from the tape, and if you perform a cross-check of the backup on standby2, then RMAN prompts you to run the cross-check on standby1. A cross-check on standby1 updates the status of the tape backup to EXPIRED when the media manager reports that the backup has been deleted.

Semantics

Syntax Element Description
maintSpec Cross-checks backups. For maintSpec options, refer to the parameter descriptions in maintSpec.

Examples

Example 2-73 Cross-Checking All Backups and Copies

This example, which assumes that the default configured channel is DEVICE TYPE sbt, cross-checks all backups and disk (partial output is included). Because RMAN preconfigures a disk channel, you do not need to manually allocate a disk channel.

RMAN> CROSSCHECK BACKUP;

allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=84 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=86 device type=DISK
backup piece handle=/disk2/backup/08i9umon_1_1 RECID=7 STAMP=614423319
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/disk2/backup/09i9umso_1_1 RECID=8 STAMP=614423448
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/disk1/cfauto/c-26213402-20130213-00 RECID=9 STAMP=614423452
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=0bi9uo81_1_1 RECID=10 STAMP=614424833
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=c-26213402-20130213-01 RECID=11 STAMP=614424851
crosschecked backup piece: found to be 'AVAILABLE'
.
.
.

Example 2-74 Cross-Checking Within a Range of Dates

This example queries the media manager for the status of the backup sets in a given six week range. RMAN uses the date format specified in the NLS_DATE_FORMAT parameter, which is 'DD-MON-YY' in this example. The first command cross-checks backups on tape only:

ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
CROSSCHECK BACKUP 
  COMPLETED BETWEEN '01-JAN-13' AND '14-FEB-13';
RELEASE CHANNEL;

The following command specifies DEVICE TYPE DISK to cross-check only disk:

CROSSCHECK BACKUP DEVICE TYPE DISK 
  COMPLETED BETWEEN '01-JAN-13' AND '14-FEB-13';

If the default channel is SBT, then you can cross-check both disk and SBT backups by running CROSSCHECK with the default channels:

CROSSCHECK BACKUP COMPLETED BETWEEN '01-JAN-13' AND '14-FEB-13';