Managed Stored Scripts in RMAN

Managed Stored Scripts in RMAN

We can create Scripts for RMAN backup and restore operation for better and easy way to use. Scripts can be local or global.
Local Script is linked with target database and global script is registered in recovery catalog so that every database can use it from catalog.
 
Create Stored RMAN Scripts
Create Script command is used to create the stored script and stored in target database. If mention Global, then it stored in recovery catalog.

1. Connect RMAN to target database and recovery catalog

— create a full backup script used default setting of show all command.
Create script full_backup
(
crosscheck archivelog all;
Backup database plus archivelog;
)–you can create global script with following syntax:
create global script full_backup_global
(
Backup database plus archivelog;
)

— Create script from file
Create script full_backup from file ‘C:\script\rmanbackup.txt’;

 
Replace Stored Scripts
Replace script command is used to modified the existing script present in target/catalog database.

— Only database backup
Replace script full_backup
(
Backup database;
)

 
Execute Stored RMAN Script
Execute script is command to run the script on RMAN prompt.

Run
{
EXECUTE SCRIPT full_backup;
}
–For global script:
RUN
{
EXECUTE GLOBAL SCRIPT full_backup_global;
}

 
List Stored RMAN Script
List script command to display the name fo script present in database.

— List all the script from connected target database
LIST SCRIPT NAMES;
— List global script
LIST GLOBAL SCRIPT NAMES;

–LIST ALL SCRIPT
LIST ALL SCRIPT NAMES;

 
Print Stored RMAN Scripts
PRINT SCRIPT Command is used for display the content of script.

— Print the local script
PRINT SCRIPT full_backup;
— Pring the global script
PRINT GLOBAL SCRIPT full_backup_global;

— Pring the script to text file
PRINT SCRIPT full_back TO FILE ‘C:\scripts\fullbackup.txt’;

 
Delete RMAN Stored script
Delete command is used to delete the stored script in catalog/target database

DELETE SCRIPT ‘full_backup’;
DELETE GLOBAL SCRIPT ‘full_backup_global’;

 
Execute script direct from OS command prompt

Rman target / catalog rman@catdb script ‘C:\script\fullbackup.txt’;

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s