I will explain RMAN CrossCheck in Oracle in this post.
Crosscheck command is used to synchronize the physical reality of backups and copies with their logical records in the RMAN repository of Controlfile. RMAN Records like backup and archivelog files are checked their physical status.
For example, if someone removes backups or archived logs from disk with an operating system command like rm, the repository still indicates that the backup and archive logs are on disk, when in fact they are not, they are removed.
When you run the Crosscheck command, If the backup is on disk, then the CROSSCHECK command determines whether the header of the file is valid. If the backup is on tape, then the command simply checks that the backup exists. The possible status values for backups are AVAILABLE, UNAVAILABLE, and EXPIRED.
After Running the Crosscheck command, You can list the status of backups using the RMAN LIST command, or by queryingV$BACKUP_FILES or many of the recovery catalog views such as RC_DATAFILE_COPY or RC_ARCHIVED_LOG.
Running a crosscheck updates the RMAN repository so that all of these methods provide accurate information. For each backup in the RMAN repository, if the backup is no longer available, then RMAN marks it as EXPIRED. If it was EXPIRED and is now available, then RMAN marks it AVAILABLE.
You can perform Crosscheck command for Backups, Copy and Archivelogs as follows.
RMAN> crosscheck backup; RMAN> crosscheck backuppiece PIECE_PATH_AND_NAME; RMAN> crosscheck copy; RMAN> crosscheck backup of database; RMAN> crosscheck backup of controlfile; RMAN> crosscheck archivelog all; RMAN> crosscheck backup of archivelog all; RMAN> crosscheck copy of controlfile; RMAN> crosscheck backupset 1453, 1881; RMAN> crosscheck backuppiece tag = 'msdb_backup'; RMAN> crosscheck controlfilecopy '/tmp/control01.ctl'; RMAN> crosscheck datafilecopy 1453, 571, 63;
You can use the COMPLETED BETWEEN command with Crosscheck command as follows.
RMAN> CROSSCHECK BACKUP DEVICE TYPE DISK COMPLETED BETWEEN '01-JAN-21' AND '14-FEB-21';
If the default channel is SBT, then you can cross-check both disk and SBT backups by running
CROSSCHECK with the default channels:
RMAN> CROSSCHECK BACKUP COMPLETED BETWEEN '01-JAN-21' AND '14-FEB-21';
996 views last month, 3 views today