Oracle® Database Backup and Recovery Reference 10g Release 2 (10.2) Part Number B14194-03 |
|
|
View PDF |
Syntax
replaceScript::=
Purpose
To replace an existing script stored in the recovery catalog. If the script does not exist, then REPLACE
SCRIPT
creates it.
A stored script is a sequence of RMAN commands, given a name and stored in the recovery catalog for later execution. A stored script may be local (that is, associated with one target database) or global (available for use with any database registered in the recovery catalog).
For more information about stored scripts and commands used to create, update, delete and execute stored scripts, see "CREATE SCRIPT".
Restrictions and Usage Notes
Execute REPLACE
SCRIPT
only at the RMAN prompt.
You must be connected to a target database and recovery catalog. If you are replacing a local script, then you must be connected to the target database that you connected to when you created the script.
When using REPLACE SCRIPT
, RMAN must be connected to a recovery catalog, and the catalog database must be open.
If no script by the specified name exists, one will be created.
Keywords and Parameters
Syntax Element | Description |
---|---|
GLOBAL |
Restricts RMAN to replacing or creating a global stored script, instead of a local one.
If omitted, RMAN looks for a local stored script |
'script_name' |
Identifies the local or global script being replaced. |
COMMENT =' comment ' |
An explanatory comment, used in the output of LIST SCRIPT NAMES.. |
FROM FILE 'filename' |
The new contents of the script are to be read from this file. The first line of the file must begin with a "{ ", the last line must contain a "} " and the commands must be valid within a RUN block. |
{ backupCommands
| | | } |
Commands valid in a stored script. These are the same commands supported within a RUN block. See "RUN" for more details about backupCommands , restoreCommands , maintenanceCommands , and miscellaneousCommands . |
Example
Replacing a Recovery Catalog Script: Example This example updates a stored script called backup_full
:
REPLACE SCRIPT backup_full COMMENT 'Run this to back up the database' { # uses configured channel for default device type BACKUP DATABASE; }
If there is a local script backup_full
, it is updated. If there is no local script backup_full
but there is a global script backup_full
, the global script is updated.