2015년 4월 20일 월요일

오라클 export 윈도우 스케쥴러 걸기 - oracle export as a windows schedule task

========================= export.bat
@echo off
set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%

set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%

set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%


set year=%date:~10,4%

set month=%date:~4,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%

set day=%date:~7,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%


set tdate=%year%-%month%-%date%
set ttime=%hour%:%min%:%secs%

echo start export %tdate% %ttime%

set cdatetime=%tdate%_%ttime%

set ORA_SID=SID
set SVRDNAME=hostname
set FOLDER=path

set BASE_NAME=%ORA_SID%_%cdatetime%
set DUMPFILE=%FOLDER%%BASE_NAME%.dmp
set LOGFILE=%FOLDER%%BASE_NAME%.log

echo %DUMPFILE%
echo %LOGFILE%

rem exp 'account/password@%SVRDNAME%/%ORA_SID% as sysdba' full=y file=%DUMPFILE% log=%LOGFILE%

set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%

set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%

set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%


set year=%date:~10,4%

set month=%date:~4,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%

set day=%date:~7,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%


set tdate=%year%-%month%-%date%
set ttime=%hour%:%min%:%secs%
echo end export %tdate% %ttime%


=========================================== task
@echo off

set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
echo hour=%hour%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
echo min=%min%
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
echo secs=%secs%

set year=%date:~10,4%
echo year=%year%
set month=%date:~4,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%
echo month=%month%
set day=%date:~7,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%
echo day=%day%

set datetimef=%year%%month%%day%_%hour%%min%%secs%

echo datetimef=%datetimef%

export.bat > ./run.%datetimef%.log

============================================================
Control Panel > Management Tools > Task Schedular

regist as a task.

댓글 없음:

댓글 쓰기