Database Reference
In-Depth Information
Creating Stored Scripts
Recovery catalog stored scripts provide the ability to centrally manage your backup and
recovery scripts. Using global stored scripts allows you to use common scripts across the
entire enterprise.
Use the CREATE SCRIPT RMAN command to store scripts in the recovery catalog. You
will assign a name to the stored script when you create it. Stored scripts can be created to
do many RMAN operations, including backups, recoveries, and database-maintenance
operations. As mentioned earlier, you must be connected to the recovery catalog to be
able to create a script.
Here is an example of using the CREATE SCRIPT command to create a script. This script
does a backup of the database and the archived redo logs:
create script db_backup_script
{ backup database plus archivelog delete input;}
Note that if you are using virtual private catalogs (see more on these later in this chapter),
you will need to create the script as a global script, as shown here:
create global script db_delete_obsolete{ delete obsolete;}
Replacing Stored Scripts
The REPLACE SCRIPT command is used to replace stored RMAN scripts. The following
example demonstrates the use of the REPLACE SCRIPT command:
Replace script db_delete_obsolete
{ delete noprompt obsolete;}
Removing Stored Scripts
If you need to remove a stored script permanently, you can use the DELETE SCRIPT command,
as shown here:
Delete script db_delete_obsolete;
Executing Stored Scripts
Once you have created the script, it might be nice to actually run it! To run the script, you
will use the EXECUTE SCRIPT command. This command must be run within the confines of
an RMAN RUN block, as shown in this example:
Run {execute script db_backup_script;}
Search WWH ::




Custom Search