Batch Script Oracle RAC rman backup to Disk (Include vote and ocr)

** Myself
set CONNECT_BAT=D:\oracle\script\connect.bat
set EXECUTE_BAT=D:\oracle\script\command.bat
set LOG_BACKUP=D:\oracle\script\log_bakup.txt
set BACKUP_PATH=I:\backup\ORCL\
set OCR_NAME=data.ocr
set VOTE_NAME=votedsk
set OCR_VOTE_DIR=J:\Cdata\crs\
set SP_ASM_DIR=J:\oradata\+asm\
set SP_ASM_NAME=spfile+ASM.ora
set SP_DB_DIR=J:\oradata\ORCL\
set SP_DB_NAME=spfileORCL.ora
echo ------------------------------------------------  >> ^%LOG_BACKUP%
date /T  >>  ^%LOG_BACKUP%
xcopy /Y /R ^%BACKUP_PATH%^%OCR_NAME%  ^%BACKUP_PATH%^%OCR_NAME%_old  >>  ^%LOG_BACKUP%
xcopy /Y /R ^%BACKUP_PATH%^%VOTE_NAME% ^%BACKUP_PATH%^%VOTE_NAME%_old >>  ^%LOG_BACKUP%
xcopy /Y /R ^%BACKUP_PATH%^%SP_ASM_NAME% ^%BACKUP_PATH%^%SP_ASM_NAME%_old >>  ^%LOG_BACKUP%
xcopy /Y /R ^%BACKUP_PATH%^%SP_DB_NAME%  ^%BACKUP_PATH%^%SP_DB_NAME%_old >>  ^%LOG_BACKUP%
xcopy /Y /R ^%OCR_VOTE_DIR%^%OCR_NAME%  ^%BACKUP_PATH%^%OCR_NAME%  >>  ^%LOG_BACKUP%
xcopy /Y /R ^%OCR_VOTE_DIR%^%VOTE_NAME% ^%BACKUP_PATH%^%VOTE_NAME% >>  ^%LOG_BACKUP%
xcopy /Y /R ^%SP_ASM_DIR%^%SP_ASM_NAME% ^%BACKUP_PATH%^%SP_ASM_NAME% >>  ^%LOG_BACKUP%
xcopy /Y /R ^%SP_DB_DIR%^%SP_DB_NAME%  ^%BACKUP_PATH%^%SP_DB_NAME% >>  ^%LOG_BACKUP%
echo rman target / nocatalog  > ^%CONNECT_BAT%
echo configure controlfile autobackup on; > ^%EXECUTE_BAT%
echo configure controlfile autobackup format for device type disk to ^'%BACKUP_PATH%^%%F^';    >> ^%EXECUTE_BAT%
echo backup device type disk tag ^'%BACKUP_PATH%^%%TAG^' database; >> ^%EXECUTE_BAT%
echo backup device type disk tag ^'%BACKUP_PATH%^%%TAG^' archivelog all not backed up delete all input; >> ^%EXECUTE_BAT%
echo allocate channel for maintenance type disk; >> ^%EXECUTE_BAT%
echo release channel; >> ^%EXECUTE_BAT%
echo ^} >> ^%EXECUTE_BAT%
call ^%CONNECT_BAT% < ^%EXECUTE_BAT% >>  ^%LOG_BACKUP%
del ^%CONNECT_BAT%
del ^%EXECUTE_BAT%

1 comments:

lek_cpe said...

Great work&website http://vgrigorian.com,excellent demonstrate.

Loading