CROSSCHECK command to synchronize the physical reality of backups and copies with their logical records in the RMAN repository.
Oracle Database Backup and Recovery User's Guide to learn how to manage database records in the recovery catalog
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.
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
V$ views, or recovery catalog views (if you use RMAN with a catalog). Table 2-4 describes the meaning of each status.
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
EXPIRED in the repository by examining the files on disk for
DISK channels or by querying the media manager for
Table 2-4 Meaning of CROSSCHECK Status
Object is not found either in file system (for
If backups are
Object is available for use by RMAN. For a backup set to be
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
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
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.
Example 2-75 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-76 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';