Monday, February 2, 2009

dynamic rman scripts example

sometimes we may require to use dynamic rman script as we may want to pass an argument to our backup sripts. Assume the tag or backup file name is what i want to change as required.

let us check an example of the same:

let us create the rman script first which will be executed through the shell script:
we will use substitution variable here.(same as we use in sqlplus)

step 1:

Create the RMAN command file that uses two substitution variables:
connect target /@database
run {
backup database
tag &a
format &b

The command file shown here will back up the database using two substitution variables (&a and &b), one for the backup tag and the other for the string value in the format specification.

step 2:
Create the shell script to run the backup command file you created in step 1:
# script name:
set tag=$argv(a)
set format=$argv[b]
rman @rman.cmd using $tag $format

step 3:
Now that you have created a dynamic shell script, you can specify the arguments for the tag and format variables on the command line, thus being able to modify them for different jobs.

Here’s an example:
$ night_backup back007

The example shows how to execute the shell script with two dynamic parameters, night_backup( for tag) and back007(for format string).

have a nice day .......................................

No man was ever wise by chance.

No comments: