Oracle DBA – A lifelong learning experience

RMAN backup script – example – logging output

Posted by John Hallas on March 20, 2008

To answer a question about writing the output from RMAN commands to a logfile I posted a copy of a shell script I use to the Oracle-L newsgroup. It is a script I use for testing which does explain the multiple RMAN commands, much of which are commented out.



export ORACLE_HOME=/u00/app/oracle/product/11.1.0/db_2




export DATE=$(date +%Y-%m-%d)

rman target backup_admin/xxxxxxx catalog rman/xxxxxxx@server msglog /export/backups/rman/11g/logs/rman_full_backup_db_online_TEST1_${DATE}.log <<EOF

#backup AS COMPRESSED BACKUPSET database ;

#backup AS COMPRESSED BACKUPSET archivelog all delete input ;

backup AS COMPRESSED BACKUPSET database plus archivelog delete input;


#backup database;

#backup archivelog all delete input;


#delete noprompt force obsolete;

#Change archivelog all validate





From the Oracle documentation I also found the following notes

Using RMAN with Command Files
A command file is a text file which contains RMAN commands as you would enter them at the command line. You can run the a command file by specifying its name on the command line. The contents of the command file will be interpreted as if entered at the command line. If the LOG command line argument is specified, RMAN directs output to the named log file. Command files are one way to automate scheduled backups through an operating system job control facility.

In this example, a sample RMAN script is placed into a command file called commandfile.rcv. You can run this file from the operating system command line and write the output into the log file outfile.txt as follows:

% rman TARGET / CATALOG rman/cat@catdb CMDFILE commandfile.rcv LOG outfile.txt
Directing RMAN Output to a Log File
When you run RMAN in command line mode, it sends the output to the terminal. If you specify the LOG option, then RMAN writes the output to a specified log file instead.

Output for currently executing RMAN jobs is also stored in the V$RMAN_OUTPUT view, which reads only from memory (that is, the information is not stored in the control file). The V$RMAN_STATUS view contains metadata about jobs in progress as well as completed jobs. The metadata for completed jobs is stored in the control file.

4 Responses to “RMAN backup script – example – logging output”

  1. Thank you so much for sharing this precious information with us.

  2. […] Posts ORA-19809: limit exceeded for recovery files – db_recovery_file_dest_size and archiver errorRMAN backup script – example – logging outputWhere has consistent=y gone when using Datapump exportPurging statistics from the SYSAUX […]

  3. Haftpflichtversicherung,Hausratversicherung,Versicherungsvergleich…

    […]RMAN backup script – example – logging output « Oracle DBA – A lifelong learning experience[…]…

  4. shahid ahmed said

    Thank you very much sharing this script. It is really useful for all of us

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 253 other followers

%d bloggers like this: