Skip to content

RMAN REPAIR FAILURE

    RMAN REPAIR FAILURE command is used to repair database failures identified by the Data Recovery Advisor.

    The recommended workflow is to run LIST FAILURE to display failures, ADVISE FAILURE to display repair options, and RMAN REPAIR FAILURE to fix the failures.

    Repairing Failures

    This example repairs all failures known to the Data Recovery Advisor. The example repairs two failures: missing data files and a data file with corrupt blocks. After the recovery, RMAN asks whether it should open the database (user-entered text is in bold).

    RMAN> LIST FAILURE;
     
    List of Database Failures
    =========================
     
    Failure ID Priority Status    Time Detected Summary
    ---------- -------- --------- ------------- -------
    142        HIGH     OPEN      23-APR-13     One or more non-system datafiles are missing
    101        HIGH     OPEN      23-APR-13     Datafile 1: '/disk1/oradata/prod/system01.dbf' 
                                                contains one or more corrupt blocks
     
    RMAN> ADVISE FAILURE;
     
    List of Database Failures
    =========================
     
    Failure ID Priority Status    Time Detected Summary
    ---------- -------- --------- ------------- -------
    142        HIGH     OPEN      23-APR-13     One or more non-system datafiles 
                                                are missing
    101        HIGH     OPEN      23-APR-13     Datafile 1: '/disk1/oradata/prod/system01.dbf' 
                                                contains one or more corrupt blocks
     
    analyzing automatic repair options; this may take some time
    using channel ORA_DISK_1
    analyzing automatic repair options complete
     
    Mandatory Manual Actions
    ========================
    no manual actions available
     
    Optional Manual Actions
    =======================
    1. If file /disk1/oradata/prod/users01.dbf was unintentionally renamed or moved, restore it
     
    Automated Repair Options
    ========================
    Option Repair Description
    ------ ------------------
    1      Restore and recover datafile 28; Perform block media recovery of 
           block 56416 in file 1
      Strategy: The repair includes complete media recovery with no data loss
      Repair script: /disk1/oracle/log/diag/rdbms/prod/prod/hm/reco_660500184.hm
    
    RMAN> REPAIR FAILURE;
     
    Strategy: The repair includes complete media recovery with no data loss
    Repair script: /disk1/oracle/log/diag/rdbms/prod/prod/hm/reco_475549922.hm
    contents of repair script:
       # restore and recover datafile
       alter database datafile 28 offline;
       restore datafile 28;
       recover datafile 28;
       alter database datafile 28 online;
       # block media recovery
       recover datafile 1 block 56416;
     
    Do you really want to execute the above repair (enter YES or NO)? YES
    executing repair script
     
    sql statement: alter database datafile 28 offline
     
    Starting restore at 23-APR-13
    using channel ORA_DISK_1
     
    channel ORA_DISK_1: starting datafile backup set restore
    channel ORA_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_DISK_1: restoring datafile 00028 to /disk1/oradata/prod/users01.dbf
    channel ORA_DISK_1: reading from backup piece /disk2/PROD/backupset/2013_04_18/o1_mf_nnndf_TAG20130418T182042_32fjzd3z_.bkp
    channel ORA_DISK_1: piece handle=/disk2/PROD/backupset/2013_04_18/o1_mf_nnndf_TAG20130418T182042_32fjzd3z_.bkp tag=TAG20130418T182042
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
    Finished restore at 23-APR-13
     
    Starting recover at 23-APR-13
    using channel ORA_DISK_1
     
    starting media recovery
    media recovery complete, elapsed time: 00:00:01
     
    Finished recover at 23-APR-13
     
    sql statement: alter database datafile 28 online
     
    Starting recover at 23-APR-13
    using channel ORA_DISK_1
    searching flashback logs for block images until SCN 429690
    finished flashback log search, restored 1 blocks
     
    starting media recovery
    media recovery complete, elapsed time: 00:00:03
     
    Finished recover at 23-APR-13
    repair failure complete

    Previewing a Repair

    The following example previews a repair of the first repair option of the most recent ADVISE FAILURE command in the current session. The sample output for the LIST FAILURE and ADVISE FAILURE commands is not shown in the example.

    RMAN> LIST FAILURE;
    .
    .
    .
    RMAN> ADVISE FAILURE;
    .
    .
    .
    RMAN> REPAIR FAILURE PREVIEW;
    
    Strategy: The repair includes complete media recovery with no data loss
    Repair script: /disk1/oracle/log/diag/rdbms/prod/prod/hm/reco_3200987003.hm
    
    contents of repair script:
       # block media recovery
       recover datafile 1 block 56416;
    

    You can use SPOOL with REPAIR FAILURE ... PREVIEW to write a repair script to a file. You can then edit this script and execute it manually. The following example spools a log a repair preview to /tmp/repaircmd.dat.

    RMAN> SPOOL LOG TO '/tmp/repaircmd.dat';
    RMAN> REPAIR FAILURE PREVIEW;
    RMAN> SPOOL LOG OFF;

    Also See:

    Oracle RMAN