How Can I Use Logging Tracing and Debugging with RMAN?

by Seth Miller

RMAN will provide more than enough information about what it is doing through its logging mechanisms. Standard logging is printed to the screen (standard output) by default. If you want to redirect standard output to a file, you can specify the LOG clause. This clause can be given as part of the initial rman command.

rman target / LOG /tmp/rman.log

It can also be enabled interactively. It is useful to note that the SPOOL LOG clause can be enabled and disabled at different parts of the session and to different files.

rman target /

RMAN> SPOOL LOG TO '/tmp/listbackup.txt';
RMAN> list backup;
RMAN> SPOOL LOG TO '/tmp/reportschema.txt';
RMAN> report schema;
RMAN> SPOOL LOG OFF;

Both of the LOG clauses (part of the rman command or SPOOL LOG) redirect the logging output. If you want both the standard output printed to screen and printed to a file, use the tee command.

rman target / | tee '/tmp/rman.log'

If you need more information than you are getting from standard logging, the next option is to use DEBUG. Debug produces a LOT of information and will likely have to be parsed to be useful. You can use the DEBUG clause on the command line to turn on debugging for the entire session. Similar to LOG the debug will print to standard output by default. Specify the TRACE parameter to capture the debug output to a file while still printing the standard logging output to the screen.

rman target / DEBUG TRACE '/tmp/rman.trc'

Similar to LOG, debug can also be turned on and off interactively. One difference though is that debugging can be enabled and disabled within a run block.

rman target / TRACE '/tmp/rman.trc'

RMAN> run {
2> debug on;
3> report schema;
4> debug off;
5> crosscheck archivelog all;
6> }

When DEBUG is enabled, both the standard logging and the trace logging are affected. The standard logging is almost exactly the same as it is without DEBUG enabled, except that each line is preceded with an RMAN-XXXXX: message identifier with the X‘s being replaced with a number.