Tuesday, August 9, 2011

"CONFIGURE" and "CREATE SCRIPT" command


CONFIGURE

Purpose:
To configure persistent settings affecting RMAN backup, restore, duplication, and maintenance jobs. 

Examples:

Configuring and Clearing Parallelism: 

CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

Configuring Backup Copies: 

This example configures duplexing to 3 for DISK backups of datafiles.

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3; 

Excluding a Tablespace from a Whole Database Backup:

CONFIGURE EXCLUDE FOR TABLESPACE example

CREATE SCRIPT:

Purpose:
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).

- The PRINT SCRIPT command is used to view the contents of a stored script.
- The REPLACE SCRIPT command is used to update the contents of a stored   script.
- The EXECUTE SCRIPT command is used to execute the commands in the stored script.
- The SCRIPT command line arguments for RMAN (described in "cmdLine") runs a stored script automatically when   starting RMAN.
- The LIST SCRIPT NAMES command is used to find out what stored scripts are defined for the current target database   and recovery catalog.
- The DELETE SCRIPT command is used to delete a stored script from the recovery catalog.

This command is valid only if recovery catalog is configured.

Examples:

Creating a Local Stored Script: 

CREATE SCRIPT backup_full 

COMMENT "backup whole database and logs"
{
    BACKUP database PLUS ARCHIVELOG;
}

Creating a Global Stored Script: 

CREATE GLOBAL SCRIPT bkp_global

COMMENT "backup any database from the recovery catalog, with logs"
{
    BACKUP DATABASE PLUS ARCHIVELOG;
}


Now you may execute this script as below:


RUN { EXECUTE script backup_full ; }

Enjoy:-)