воскресенье, 26 февраля 2012 г.

RMAN Script

Взято из других источников:

To create and use a dynamic shell script:
1. Create an RMAN command file that uses substitution variables.
The following example shows the contents of a command file named
quarterly_backup.cmd, which is run every quarter. The script uses
substitution variables for the name of the tape set, for a string in the FORMAT
specification, and for the name of the restore point to be created.



#
quarterly_backup.cmd
CONNECT
TARGET /
RUN
{
ALLOCATE
CHANNEL c1
DEVICE TYPE
sbt
PARMS
'ENV=(OB_MEDIA_FAMILY=&1)';
BACKUP
DATABASE
TAG &2
See
Also: Oracle Database Backup and Recovery Reference for RMAN
command-line
syntax
Entering
RMAN Commands
Starting and Interacting with the RMAN Client 4-5
FORMAT
'/disk2/bck/&1%U.bck'
KEEP
FOREVER
RESTORE
POINT &3;
}

2. Create a shell script that you can use to run the RMAN command file
created in the previous step.
The following example creates a shell script named runbackup.sh. The example
creates shell variables for the format and restore point name and accepts the
values for these variables as command-line arguments to the script.
#!/bin/tcsh
# name:
runbackup.sh
# usage:
use the tag name and number of copies as arguments
set
media_family = $argv[1]
set format
= $argv[2]
set
restore_point = $argv[3]
rman
@'/disk1/scripts/whole_db.cmd' USING $media_family $format $restore_point
3. Execute the shell script created in the previous step, specifying the
desired
arguments
on the command line.

The following example runs the runbackup.sh shell script and passes it
archival_backup as the media family name, bck0906 as the format string, and
FY06Q3 as the restore point name.
% runbackup.sh archival_backup bck0906 FY06Q3

Комментариев нет: