Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Tuesday, April 02, 2013

Scheduling RMAN Batch job for backup

Scenerio:

To take the RMAN backup by OS scheduled job (on Windows)



1- Create rman script file eg; D:\rmanbackup\scripts\backup.rcv
RUN {
ALLOCATE CHANNEL ch00 TYPE DISK FORMAT 'D:\rmanbackup\db\%d_DB_%u_%s_%p';
crosscheck backup;
backup
filesperset 4
INCREMENTAL LEVEL 0 AS COMPRESSED BACKUPSET database include current controlfile;
sql "alter system archive log current";
release channel ch00;
ALLOCATE CHANNEL CH01 TYPE DISK FORMAT 'D:\rmanbackup\db\al_%U';
backup
filesperset 4
AS COMPRESSED BACKUPSET archivelog all delete input;
restore database validate;
delete noprompt archivelog until time 'SYSDATE-3';
delete noprompt obsolete;
RELEASE CHANNEL CH01;
}

2- Create OS Batch file eg; D:\rmanbackup\scripts\backup.bat

set ORACLE_HOME=D:\app\inam\product\11.2.0.3\dbhome_1
set PATH=D:\app\inam\product\11.2.0.3\dbhome_1\bin
set RMAN_SCRIPT=backup.rcv
SET ORACLE_SID=homedb
set day=%date:~0,3%
set mm=%date:~4,2%
set dd=%date:~7,2%
set yy=%date:~-4%
set RMAN_LOG_NAME=rman_backup_L0_%yy%%mm%%dd%.log
rman target /  CMDFILE=D:\rmanbackup\scripts\%RMAN_SCRIPT% LOG=D:\rmanbackup\log\%RMAN_LOG_NAME%


3- Schedule the OS job using the batch file created in step 2.

No comments: