Sie sind auf Seite 1von 4

Page 1 of 4

Subject: How To Use RMAN To Check For Logical & Physical Database Corruption Doc ID: 283053.1 Modified Date: 06-AUG-2009 Type: BULLETIN Status: PUBLISHED

*** This article is being delivered in Draft form and may contain errors. Please use the MetaLink "Feedback" button to advise Oracle of any issues related to this article. *** PURPOSE ------To explain how RMAN can be used to check for both logical and physical corruption.

SCOPE & APPLICATION ------------------This document is intended for database adminstrators of all levels. Note: No need that RMAN has been used or setup previously. There is no need for a recovery catalog. No backup is created. Since a single channel is being allocated there is little overhead. The only requirement is that Oracle8i or later has to be used and the database is mounted (required for a noarchivelog mode database) or open. During a RMAN backup or RMAN 'backup validate' every block currently used or previously used is read into memory then written to another portion of memory. During this memory to memory write the block is checked for corruption. Therefore RMAN's BACKUP command with the VALIDATE and CHECK LOGICAL clauses allow a Database Adminstrator to quickly check for both physical and logical corruption. If the initialization parameter DB_BLOCK_CHECKSUM=TRUE, specifying CHECK LOGICAL detects all types of corruption that are possible to detect.

How To Use RMAN To Check For Logical And Physical Block Corruption ------------------------------------------------------------------*** For databases in noarchivelog mode, *** *** the commands that follow only work *** *** while the database is in mount mode ***


For version 9.2 or higher, query v$database_block_corruption to see if there are any rows already listed there.


Set your $ORACLE_SID and $ORACLE_HOME appropriately if not already set.


Start RMAN in nocatalog mode and connect to your database:

From the operating system prompt issue: $ rman target / nocatalog or


Page 2 of 4

$ rman target sys/<sys_password> nocatalog

4) From the RMAN> prompt issue the validate command with the "check logical" clause: The following example shows how to validate all datafiles: run { allocate channel d1 type disk; backup check logical validate database; release channel d1; } You'll see output like this: Starting backup at 15-SEP-04 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=17 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=C:\ORACLE\ORADATA\ORA92\SYSTEM01.DBF input datafile fno=00002 name=C:\ORACLE\ORADATA\ORA92\UNDOTBS01.DBF input datafile fno=00005 name=C:\ORACLE\ORADATA\ORA92\EXAMPLE01.DBF input datafile fno=00010 name=C:\ORACLE\ORADATA\ORA92\XDB01.DBF input datafile fno=00006 name=C:\ORACLE\ORADATA\ORA92\INDX01.DBF input datafile fno=00009 name=C:\ORACLE\ORADATA\ORA92\USERS01.DBF input datafile fno=00003 name=C:\ORACLE\ORADATA\ORA92\CWMLITE01.DBF input datafile fno=00004 name=C:\ORACLE\ORADATA\ORA92\DRSYS01.DBF input datafile fno=00007 name=C:\ORACLE\ORADATA\ORA92\ODM01.DBF input datafile fno=00008 name=C:\ORACLE\ORADATA\ORA92\TOOLS01.DBF <<<<< SCREEN OUTPUT MAY PAUSE HERE FOR A WHILE >>>>> channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 Finished backup at 15-SEP-04 The following example shows how to validate a single datafile: run { allocate channel d1 type disk; backup check logical validate datafile 1; release channel d1; } The following example shows how to validate two datafiles: run { allocate channel d1 type disk; backup check logical validate datafile 1, 2; release channel d1; } The following example shows how to run a validate with multiple channels. is helpful for very large databases, datafiles, etc: run { allocate channel d1 type disk; allocate channel d2 type disk; backup check logical validate database; This


Page 3 of 4

release channel d1; release channel d2; } If you wish to monitor the progress of RMAN backup validate, you may issue this query: SQL> select sid, serial#, context, sofar, totalwork, round(sofar/totalwork*100,2) "%_complete" from v$session_longops where opname like 'RMAN%' and opname not like '%aggregate%' and totalwork != 0 and sofar <> totalwork /


Once the validate process is complete, you either check the alert log or a view depending on the version of Oracle being used.

In Oracle8i corruptions found with the RMAN validate command are only reported in the alert log. Oracle8i users must search the alert.log for corruption errors in the time range during which the validate command was started and when it finished. Corruptions found are NOT reported back to the RMAN interface. In Oracle9i and beyond you can query the view name V$DATABASE_BLOCK_CORRUPTION to determine what corruption, if any, was found by RMAN. As in Oracle8i, corruptions found are NOT reported back to the RMAN interface. Note that corruption reported in V$DATABASE_BLOCK_CORRUPTION is cleared with each RMAN backup validate run. If new corruption is found this view is updated with the new corruption details. Rows in this view are not removed until another RMAN backup validate or RMAN backup is run AND during which corruption for a block is longer detected. To understand what is reported in this view, see the description of the view as shown in the manual titled Database Reference.

RELATED DOCUMENTS ----------------Oracle9i Recovery Manager Reference, Validate Oracle9i Recovery Manager User's Guide, Chapter 9, Performing a Backup Validation with RMAN Oracle8i Recovery Manager User's Guide and Reference, Validate Note Note Note Note Note Note 109159.1 338607.1 28814.1 377146.1 561010.1 836658.1 RMAN: Checking the Progress of RMAN Backup/Recovery How To Check (Validate) If RMAN Backup(s) Are Good Handling Oracle Block Corruptions in Oracle7/8/8i/9i How to Check Archivelogs for Corruption using RMAN Which Blocks Will RMAN Check For Corruption? Identify the corruption extension using RMAN/DBV/ANALYZE etc

MODIFICATION HISTORY -------------------20-Oct-2004: Added affected product versions to header 29-Jul-2005: Added section showing how to run with multiple channels. 22-Feb-2006: Added Note 338607.1 to Related Documents section. 09-Feb-2007: Added Note 377146.1 to Related Documents section.


Page 4 of 4