Batch Script Oracle offline backup to Disk

** Myself
set ORACLE_SID=ORCL
set CONNECT_BAT=D:\oradb_backup\script_ora_offline\connect.bat
set EXECUTE_BAT=D:\oradb_backup\script_ora_offline\command.bat
set EXECUTE_TEMP=D:\oradb_backup\script_ora_offline\command.txt
set LOG_BACKUP=D:\oradb_backup\script_ora_offline\log_offlien_bakup.txt
set BACKUP_PATH=D:\oradb_backup\ORCL_back\
set SOURCE_PATH=D:\oracle\oradata\
set PARA_DB_PATH=D:\oracle\ora92\database\
set PARA_NET_PATH=D:\oracle\ora92\Network\admin\
echo ------------------------------------------------  >> ^%LOG_BACKUP%
date /T  >>  ^%LOG_BACKUP%
echo ---------------START BACKUP---------------  >>  ^%LOG_BACKUP%
echo sqlplus /nolog > ^%CONNECT_BAT%
echo connect / as sysdba > ^%EXECUTE_BAT%
echo shutdown immediate >> ^%EXECUTE_BAT%
call ^%CONNECT_BAT% < ^%EXECUTE_BAT%  >> ^%LOG_BACKUP%
xcopy /Y /R %SOURCE_PATH% %BACKUP_PATH% >> ^%LOG_BACKUP%
xcopy /Y /R %PARA_DB_PATH% %BACKUP_PATH% >> ^%LOG_BACKUP%
xcopy /Y /R %PARA_NET_PATH% %BACKUP_PATH% >> ^%LOG_BACKUP%
echo sqlplus /nolog > ^%CONNECT_BAT%
echo connect / as sysdba > ^%EXECUTE_BAT%
echo startup >> ^%EXECUTE_BAT%
call ^%CONNECT_BAT% < ^%EXECUTE_BAT%  >> ^%LOG_BACKUP%
date /T  >>  ^%LOG_BACKUP%
echo ---------------FINISH BACKUP---------------  >>  ^%LOG_BACKUP%
del ^%CONNECT_BAT%
del ^%EXECUTE_BAT%
del ^%EXECUTE_TEMP%

0 comments:

Loading