Wednesday, January 16, 2013

Scheduling RMAN Batch job for backup


rman script file

D:\rmanbackup\scripts\backupL0.rcv

Batch File

D:\rmanbackup\scripts\backup.bat

Contents of  D:\rmanbackup\scripts\backupL0.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;
}

------------------------------------------------------------------------------------------------------

Contents of

D:\rmanbackup\scripts\backup.bat


set ORACLE_HOME=D:\app\farif\product\11.2.0.3\dbhome_1
set PATH=D:\app\farif\product\11.2.0.3\dbhome_1\bin
set RMAN_SCRIPT=backupL0.rcv
SET ORACLE_SID=mydb
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%





No comments:

Post a Comment