11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 6 ■ BACKUP AND RECOVERY 2712. Create the shell script to run the backup script you created in step 1:#!/bin/tcsh# script name: yearly_backup.shset tag=$1set format =$2rman @backup.cmd using $tag $formatNote that you have to specify the using clause when employing a dynamic commandfile. The using clause will specify which substitution variables will be used. In this example,the two substitution variables are tag and format.3. Specify the arguments for the tag and format variables when you invoke the backupshell script, as shown in the following example:$ yearly_backup.sh longterm_backup back0420The example shows how to execute the shell script yearly_backup with two dynamicparameters, longterm_backup (tag) and back0420 (format string).The previous example showed you how to create a dynamic command file. You can alsoemploy substitution variables in a create script command to create a dynamic stored script.To do this, simply specify the substitution variables for all values that you want to be dynamicallyupdated. Before you can create a dynamic stored script, you must specify the using clausewhen you start RMAN at the command line and also pass the initial values for the substitutionvariables you want to use in the stored script. Once you invoke RMAN in this fashion, you mustcreate the dynamic stored script. Here’s how to create a dynamic stored script that uses substitutionvariables:1. Create a command file with the create script statement using substitution variablesfor those values that you want to pass dynamically at script execution time. Here’s thecommand file with the create script statement:create script quarterly{backuptag &1format '/u01/app/oracle/bck/&2%U.bck'keep foreverrestore point &3database;}The create script statement includes three substitution variables, &1, &2, and &3, whichstand for tag, part of the format string, and restore point, respectively. We’ll name thiscommand file testcmd1 and use it to create the stored script.2. Connect RMAN to both the target database and the recovery catalog (since we’re usingthe keep forever clause). Also, specify the initial values for all three of the substitutionvariables:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!