There are several different methods for reporting on the RMAN environment:
• LIST command
• REPORT command
• Query metadata via data dictionary views
When first learning RMAN, the difference between the LIST and REPORT commands may seem confusing because the distinction between the two is not clear-cut. In general, I use the LIST command to view information about existing backups and use the REPORT command to determine which files need to be backed or to display information on obsolete or expired backups.
SQL queries can provide details for specialized reports (not available via LIST or REPORT) or for automating reports, for example, generally implementing an automated check via a shell script and SQL that reports whether the RMAN backups have run within the last day.
Using LIST
When investigating issues with RMAN backups, usually one of the first tasks I undertake is connecting to the target database and running the LIST BACKUP command. This command allows you to view backup sets, backup pieces, and the files included in the backup:
RMAN> list backup;
The command shows all RMAN backups recorded in the repository. You may want to spool the backups to an output file so that you can save the output and then use an OS editor to search through and look for specific strings in the output.
To get a summarized view of backup information, use the LIST BACKUP SUMARY command:
RMAN> list backup summary;
You can also use the LIST command to report just image copy information:
RMAN> list copy;
To list all files that have been backed up and the associated backup set, issue the following command:
RMAN> list backup by file;
These commands display archivelogs on disk:
RMAN> list archivelog all;
RMAN> list copy of archivelog all;
Also, this command lists the backups of the archivelogs (and which archivelogs are contained in which backup pieces):
RMAN> list backup of archivelog all;
There are a great many ways in which you can run the LIST command (and, likewise, the REPORT command, covered in the next section). The prior methods are the ones you will run most of the time. See the Oracle Database Backup and Recovery Reference Guide
documentation for a complete list of options.
Using REPORT
The RMAN REPORT command is useful for reporting on a variety of details. You can quickly view all the data files associated with a database, as follows:
RMAN> report schema;
The REPORT command provides detailed information about backups marked obsolete via the RMAN retention policy; for example,
RMAN> report obsolete;
You can report on data files that need to be backed up, as defined by the retention policy, like this:
RMAN> report need backup;
There are several ways to report on data files that need to be backed up. Here are some other examples:
RMAN> report need backup redundancy 2;
RMAN> report need backup redundancy 2 datafile 2;
The REPORT command may also be used for data files that have never been backed up or that may contain data created from a NOLOGGING operation. For example, say you have direct-path loaded data into a table, and the data file in which the table resides has not been backed up. The following command will detect these conditions:
RMAN> report unrecoverable;