Oracle自动备份脚本 [ Windows]

729次阅读

共计 916 个字符,预计需要花费 3 分钟才能阅读完成。

@ECHO OFF
set ora_path=G:\oracle\product\10.2.0\db_1\BIN
set ORACLE_SID=orcl
set bakfile_path=G:\backup\oradmp

del G:\backup\myfile.txt
del G:\backup\myfile1.txt
date /t >>G:\backup\myfile.txt
time /t >>G:\backup\myfile1.txt
for /F "eol=; tokens=1 delims=/ " %%i in (G:\backup\myfile.txt) do set outp1=%%i
for /F "eol=; tokens=2 delims=/ " %%i in (G:\backup\myfile.txt) do set outp2=%%i
for /F "eol=; tokens=3 delims=/ " %%i in (G:\backup\myfile.txt) do set outp3=%%i
for /F "eol=; tokens=1 delims=: " %%i in (G:\backup\myfile1.txt) do set outp4=%%i
for /F "eol=; tokens=2 delims=: " %%i in (G:\backup\myfile1.txt) do set outp5=%%i
set outp6=20_full_%outp1%-%outp2%-%outp3%_%outp4%_%outp5%
set DaysAgo=2
forfiles /p %bakfile_path% /s /m *.dmp /d -%DaysAgo% /c "cmd /c del @path" 
forfiles /p %bakfile_path% /s /m *.log /d -%DaysAgo% /c "cmd /c del @path" 


%ora_path%\expdp.exe system/****** directory=expdp_dir2 dumpfile=%outp6%_%%U.dmp filesize=8192M logfile=%outp6%.log parallel=1 full=y
copy %bakfile_path%\%outp6%.log G:\backup\log

 

正文完
 
mervinwang
版权声明:本站原创文章,由 mervinwang 2018-06-26发表,共计916字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
文章搜索