You can use below scripts to schedule backup jobs using task scheduler.
===================================================================
ECHO OFF
SET TMPSCRIPT=E:\rman\backup\fullbackup\rman_temp.txt
CD /D E:\rman\backup\fullbackup
set temp=%DATE:/=%
set tem=%RANDOM%
set dirname=%temp:~4,2%%temp:~6,2%%temp:~8,4%%tem:~0,2%%tem:~3,2%
mkdir "%dirname%"
set oracle_sid=test
ECHO RUN > %TMPSCRIPT%
ECHO { >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c1 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c2 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c3 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c4 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO BACKUP INCREMENTAL LEVEL 0 DATABASE TAG FULL_DB_BKP format 'E:\rman\backup\fullbackup\%dirname%\FULL-%%d_id-%%I_%%u'; >> \fullbackup\%dirname%\DB-%%d_id-%%I_%%u'; >> %TMPSCRIPT%
ECHO backup tag FULL_ARCH format 'E:\rman\backup\fullbackup\%dirname%\FULL_ARCH-%%d_id-%%I_%%u' archivelog all delete all input ; >> %TMPSCRIPT%
ECHO backup tag FULL_CTL current controlfile format 'E:\rman\backup\fullbackup\%dirname%\FULL_DB_CONTROL.bkp'; >> %TMPSCRIPT%
ECHO release channel c1; >> %TMPSCRIPT%
ECHO release channel c2; >> %TMPSCRIPT%
ECHO release channel c3; >> %TMPSCRIPT%
ECHO release channel c4; >> %TMPSCRIPT%
ECHO } >> %TMPSCRIPT%
rman target / @%TMPSCRIPT% log='E:\rman\backup\fullbackup\%dirname%\full_rman.log'
===================================================================
===================================================================
ECHO OFF
SET TMPSCRIPT=E:\rman\backup\incremental\rman_temp.txt
CD /D E:\rman\backup\incremental
set temp=%DATE:/=%
set tem=%RANDOM%
set dirname=%temp:~4,2%%temp:~6,2%%temp:~8,4%%tem:~0,2%%tem:~3,2%
mkdir %dirname%
set oracle_sid=test
ECHO RUN > %TMPSCRIPT%
ECHO { >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c1 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c2 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c3 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO ALLOCATE CHANNEL c4 DEVICE TYPE disk; >> %TMPSCRIPT%
ECHO BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE TAG INCR_DB_BKP format 'E:\rman\backup\incremental\%dirname%\INCR-%%d_id-%%I_%%u'; >> \incremental\%dirname%\DB-%%d_id-%%I_%%u'; >> %TMPSCRIPT%
ECHO backup tag INCR_ARCH format 'E:\rman\backup\incremental\%dirname%\INCR_ARCH-%%d_id-%%I_%%u' archivelog all delete all input ; >> %TMPSCRIPT%
ECHO backup tag INCR_CTL current controlfile format 'E:\rman\backup\incremental\%dirname%\DB_CONTROL.bkp'; >> %TMPSCRIPT%
ECHO release channel c1; >> %TMPSCRIPT%
ECHO release channel c2; >> %TMPSCRIPT%
ECHO release channel c3; >> %TMPSCRIPT%
ECHO release channel c4; >> %TMPSCRIPT%
ECHO } >> %TMPSCRIPT%
rman target / @%TMPSCRIPT% log='E:\rman\backup\incremental\%dirname%\incr_rman.log'
===================================================================
Thanks,
No comments:
Post a Comment