Databases Reference
In-Depth Information
Capturing Output with tee
When you start RMAN, you can send the output you see on your screen to an OS text file, using the tee command:
$ rman | tee /tmp/rman.log
Now, you can connect to the target database and run commands. All the output seen on your screen will be
logged to the / tmp/rman.log file:
RMAN> connect target /
RMAN> backup database;
RMAN> exit;
The tee party session stops writing to the log file when you exit RMAN.
Capturing Output with script
The script command is useful because it instructs the OS to log any output that appears at the terminal to a log file.
To capture all output, run the script command before connecting to RMAN:
$ script /tmp/rman.log
Script started, file is /tmp/rman.log
$ rman target /
RMAN> backup database;
RMAN> exit;
To end a script session, press Ctrl+D, or type exit . The /tmp/rman.log file will contain all output that was
displayed on your screen. The script command is useful when you need to capture all the output from a particular
time range. For example, you may be running RMAN commands, exiting from RMAN, running SQL*Plus commands,
and so on. The script session lasts from the point at which you start script to the point at which you press Ctrl+D.
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
 
Search WWH ::




Custom Search