next up previous contents
Next: Advanced Recovery Up: Using RMAN Previous: Listing Backups   Contents

Advanced Backup

The method we used for a basic RMAN backup shows how to use RMAN but it doesn't provide an efficient way to automate the proccess using traditional tools like the cron. Using alittle RMAN scripting the proccess can easily be controlled from a script and run from cron or any other schedualling method you'd like.

The foundation of this method of using RMAN is built on the run block. Within the block are a list of RMAN commands to be sequentually run. When the block is handled by RMAN it will first verify that each of the input lines in the block are valid and proper, it will then execute each statement line by line sequentually. This is as close a method as possible to ensure the operation is atomic.

Here is a simple RMAN run block (the backup_full.rman we'll use in a minute):

run {
   allocate channel d1 type disk;
   backup full database format '/export/rman/rman_%n_%T_%s_%p.bus';
}

In this run block we're simply allocating a disk channel and preforming a backup to the /export/rman directory using a specific naming convension for the output backup set.

This run block can be run directly from the RMAN prompt by entering it line by line or calling the script. However, the more appropriate way to execute it is from a standard command line where it can be wrapped in a script and/or controlled from cron.

[oracle@vixen RMAN]$ rman nocatalog target / \
> cmdfile='backup_full.rman' log='/export/rman/rman.log'
RMAN> 2> 3> 4> 5> 
[oracle@vixen RMAN]$

Here the rman executable is called as it would normally be, but we supply the location of an RMAN script to run with the cmdfile argument and a place to output the logging information with the log argument.

When RMAN is executing it will output the RMAN prompts but nothing else. This can be useful for debugging, but should probly be redirected for cleanliness when used from a script or cron.

Comments can be put in RMAN scripts using a hash (#).

More details on command line options can synatex for run blocks can be found in the Oracle Database Recovery Manager Reference:

http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10770/


next up previous contents
Next: Advanced Recovery Up: Using RMAN Previous: Listing Backups   Contents
2005-02-10