Monday, March 17, 2008

RMAN Scripts - Creating and running from Catalog Database

CONNECT TARGET SYS/password@prod
CONNECT CATALOG rman/password@catdb
CREATE SCRIPT backup_whole
COMMENT "backup whole database and archived redo logs"
{
BACKUP
INCREMENTAL LEVEL 0 TAG backup_whole
FORMAT "/disk2/backup/%U"
DATABASE PLUS ARCHIVELOG;
}
RUN { EXECUTE SCRIPT backup_whole; }

For scripts using substitution varialbles:
CREATE SCRIPT backup_df { BACKUP DATAFILE &1 TAG &2.1 FORMAT '/disk1/&3_%U'; }

RUN { EXECUTE SCRIPT backup_df USING 3 test_backup df3; }
-------------
RMAN> LIST SCRIPT NAMES;

List of Stored Scripts in Recovery Catalog

RMAN> DELETE GLOBAL SCRIPT global_backup_db;

No comments: