Posted 1/17/2009 12:23:30 PM
|
|
|
|
RMAN Crosscheck
Crosschecks update outdated RMAN repository information about backups whose repository records do not match their physical status. For example, if a user removes archived logs from disk with an operating system command, the repository still indicates that the logs are on disk, when in fact they are not.
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.
You can view 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 updaets 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.
Note: The CROSSCHECK command does not delete operating system files, and it does not remove RMAN repository records of backups that are not available at the time of the crosscheck. It only updates the repository records with the status of the backups. Use the DELETE command to remove records of expired backups from the RMAN repository.
Basic Use of CROSSCHECK with Backup Sets and Image Copies
After connecting to the target database and recovery catalog (if you use one), run CROSSCHECK commands as needed to verify the status and availability of backups known to RMAN.
If you have channnels configured for your tape or other media manager, you can crosscheck all backups on all media with CROSSCHECK BACKUP as shown in this example:
CROSSCHECK BACKUP;
If you do not have configured channels for your tape backups, you can allocate a maintenance channel in a RUN block before running CROSSCHECK as in this example:
RUN { ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt; CROSSCHECK BACKUP; }
This example shows how to crosscheck disk image copies only:
CROSSCHECK COPY; # crosschecks only disk copies of # database files
This example shows how to crosscheck backup sets only:
CROSSCHECK BACKUPSET; # crosschecks backupsets on disk and SBT
Crosschecking Specific Backup Sets and Copies
You can use the LIST command to report your backups and then use the CROSSCHECK command to check that specific backups described in the LIST output still exist. The DELETE EXPIRED command deletes repository records for backups that fail the crosscheck.
To crosscheck specified backups:
1.
Identify the desired backups that you want to check by issuing a LIST command. For example, issue:
LIST BACKUP; # lists all backup sets, proxy copies, and image copies
2.
Check whether the specified backups still exist. For example, enter:
CROSSCHECK BACKUP; # checks backup sets, proxy copies, and image copies CROSSCHECK COPY OF DATABASE; CROSSCHECK BACKUPSET 1338, 1339, 1340; CROSSCHECK BACKUPPIECE TAG = 'nightly_backup'; CROSSCHECK CONTROLFILECOPY '/tmp/control01.ctl'; CROSSCHECK DATAFILECOPY 113, 114, 115; CROSSCHECK PROXY 789;
Crosschecking Backups of Specific Database Files
You can use options of the CROSSCHECK command to check only backups of a specific database, tablespace, datafile, control file, or archived redo log. For example:
CROSSCHECK BACKUP OF DATAFILE "?/oradata/trgt/system01.dbf" COMPLETED AFTER 'SYSDATE-14'; CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;
You can check for backups of archived redo logs and SPFILE using this command:
CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;
Limiting RMAN CROSSCHECK to a Backups Since a Specific Time
You can add a COMPLETED AFTER clause to a CROSSCHECK command to restrict the checking to backups created after a specified point in time. For example, this command checks for backups of a datafile created in the last week:
CROSSCHECK BACKUP OF DATAFILE 4 COMPLETED AFTER 'SYSDATE-14';
Admin
|
|
Posted 1/18/2009 3:26:08 PM
|
|
|
|
|
|
Posted 1/18/2009 7:57:22 PM
|
|
|
|
If you have a script like this:
. $HOME/.profile
export ORACLE_SID=
rman target sys/password nocatalog << EOF
crosscheck archivelog all;
delete expired archivelog all;
Yes
..
..
If you need the script to ignore asking you "Do you really want to delete ... (YES is needed)" and sometimes there is nothing to delete (YES is not needed)?
If you want to stop it from asking you, you can add a no prompt option to it. Here is an example.
RMAN> delete expired archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=137 devtype=DISK
specification does not match any archive log in the recovery catalog
RMAN> delete noprompt expired archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=137 devtype=DISK
specification does not match any archive log in the recovery catalog
|
|
|
|