jueves, 1 de octubre de 2009

RMAN Using Recovery Advisor

Listing Failures

You suspect you have a media failure in your database. You want to use the Data Recovery Advisor to list media failures.

Use the list failure command as shown here:

RMAN> list failure;

Can determine the location of the base directory for the ADR by viewing the diagnostic_dest initialization parameter. You can view the names and values of directories in the ADR with this query:

SQL> select name, value from v$diag_info;

If you suspect there is a problem with your database and the Data Recovery Advisor is not reporting a failure, you can proactively initiate a database health check by running the following

RMAN> validate database;

RMAN> list failure 15 detail;

Table 20-1. Data Recovery Advisor List Failure Options Failure Type Description
ALL Lists all failures

CRITICAL Lists only critical failures with an OPEN status
HIGH Lists only high-priority failures with an OPEN status
LOW Lists only low-priority failures with an OPEN status CLOSED Lists failures with a CLOSED status
EXCLUDE FAILURE Excludes failures by a specified failure number
DETAIL Provides verbose description of the failure

If you want to see all failures that have been resolved and closed, then use the closed clause:

RMAN> list failure closed;

Getting Advice


You’ve experienced a media failure. You want to get advice from the Data Recovery Advisor about how to restore and recover your database.


First use the list failure command to display all failures (see recipe 20-1 for details). If you have only one failure associated with your database, then you can run the advise failure command without any parameters:

RMAN> advise failure;

RMAN> advise failure 15;

specifying one of the following keywords: ALL, CRITICAL, HIGH, or LOW. This example
displays advice about just the critical errors:

RMAN> advise failure critical;

Repairing Failures


You’ve experienced a media failure. You want to use the Data Recovery Advisor to perform a restore and recovery.


We recommend that you always run the following RMAN commands in this order:

1. list failure
2. advise failure
3. repair failure

By running list failure and advise failure, you will gain an understanding as to what
the problem is and how to fix it. You can use the repair failure command to run the repair script generated by the Data Recovery Advisor:

RMAN> repair failure;

You will be prompted to specify whether you want to run the repair script:
Do you really want to execute the above repair (enter YES or NO)?

RMAN> repair failure preview;

The preview clause instructs RMAN to display only the commands that it recommends be
run to resolve the failure. If you want to spool the output of a preview command to a file, then use the spool command:

RMAN> spool log to rmanout.txt;
RMAN> repair failure preview;

If you don’t want to be prompted during a repair session, then use the noprompt clause:

RMAN> repair failure noprompt;