Database Reference
In-Depth Information
Logging Output to a File
An easy way to capture RMAN output is to use the
SPOOL LOG
command to send the output to a file. This example
spools a log file from within RMAN:
RMAN> spool log to '/tmp/rmanout.log'
RMAN> set echo on;
RMAN> <run RMAN commands>
RMAN> spool log off;
By default the
SPOOL LOG
command will overwrite an existing file. If you want to append to the log file, use the
keyword
APPEND
:
RMAN> spool log to '/tmp/rmanout.log' append
You can also direct output to a log file when starting RMAN on the command line, which will overwrite an
existing file:
$ rman target / log /tmp/rmanout.log
You can also append to the log file, as follows:
$ rman target / log /tmp/rmanout.log append
When you use
SPOOL LOG
as shown in the previous examples, the output goes to a file and not to your terminal.
Therefore, I hardly ever use
SPOOL LOG
when running RMAN interactively. The command is mainly a tool for
capturing output when running RMAN from scripts.
Querying for Output in the Data Dictionary
If you don't capture any RMAN output, you can still view the most recent RMAN output by querying the data
dictionary. The
V$RMAN_OUTPUT
view contains messages recently reported by RMAN:
select sid, recid, output
from v$rman_output
order by recid;
The
V$RMAN_OUTPUT
view is an in-memory object that holds up to 32,768 rows. Information in this view is cleared
out when you stop and restart your database. The view is handy when you're using the RMAN
SPOOL LOG
command to
spool output to a file and cannot view what is happening at your terminal.
RMAN Reporting
There are several different methods for reporting on the RMAN environment:
LIST
command
•
REPORT
command
•
•
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 the
REPORT
command to determine which files need to be backed or to display information on
obsolete or expired backups.
Query metadata via data dictionary views