Scotech Scotech
Knowledge Base
[ Home | KB | Tools | Requests? ]


Oracle 10g RMAN config and backup scripts


Make sure that a directory exists for the backups.

mkdir $ORACLE_HOME/backups

We are not going to perform this step for our purposes. However, we're going to document the command for anyone wanting to utilize this. This is how you would include the control file and SPFILE in each database backup automatically.

RMAN> configure controlfile autobackup on;

We want to configure the RMAN retention policy to keep 2 full backups available. Older backups will get removed from the system.

RMAN> configure retention policy to redundancy 2;

Assuming a weekly full backup with a desired retention of 2 fulls, we need to setup the control file to maintain at leat 14 days worth of RMAN catalogs.

SQL> alter system set control_file_record_keep_time=21 scope=both;

Show RMAN settings and database structure.

RMAN> show all;
RMAN> report schema;

List archive logs and backup sets; delete backup sets.

RMAN> list archivelog all;
RMAN> list backup of database;
RMAN> delete backupset [number];

RMAN script for a FULL backup.

RUN {
BACKUP FORMAT '$ORACLE_HOME/backups/%T_%d_FULL_DB_%u.bak' INCREMENTAL LEVEL 0 DATABASE TAG 'FULL_DB' PLUS ARCHIVELOG TAG 'FULL_DB' DELETE INPUT;
BACKUP FORMAT '$ORACLE_HOME/backups/%T_%d_FULL_CF_%u.bak' CURRENT CONTROLFILE TAG 'FULL_CF';
BACKUP FORMAT '$ORACLE_HOME/backups/%T_%d_FULL_SP_%u.bak' SPFILE TAG 'FULL_SP';
DELETE NOPROMPT OBSOLETE;
}

RMAN script for a INCR backup.

RUN {
BACKUP FORMAT '$ORACLE_HOME/backups/%T_%d_INCR_DB_%u.bak' INCREMENTAL LEVEL 1 CUMULATIVE DATABASE TAG 'INCR_DB' PLUS ARCHIVELOG TAG 'INCR_DB' DELETE INPUT;
BACKUP FORMAT '$ORACLE_HOME/backups/%T_%d_INCR_CF_%u.bak' CURRENT CONTROLFILE TAG 'INCR_CF';
BACKUP FORMAT '$ORACLE_HOME/backups/%T_%d_INCR_SP_%u.bak' SPFILE TAG 'INCR_SP';
}

- Scotech



[ Home | KB | Tools | Email: info@scotech.com ]

© 1996-2010 Scotech. All rights reserved.