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:
#rman.cmd
connect target /@database
run {
backup database
tag &a
format &b
}
exit;
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:
#!/bin/sh
# script name: dynamic_backup.sh
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:
$ dynamic_backup.sh night_backup back007
The example shows how to execute the shell script dynamic_backup.sh with two dynamic parameters, night_backup( for tag) and back007(for format string).
thanks,
have a nice day .......................................
No man was ever wise by chance.
Seneca
No comments:
Post a Comment