用批处理进行按星期的数据库备份

需要按星期进

@echo off
echo ———–
echo name: Oracle data export automata utility
echo author: WANG Liangxu
echo date: 2006-8-7
echo refined by NAN Zhuotong
echo documented by NAN Zhuotong
echo Any problem please contact us via wlx@mygis.org; nztong@lzb.ac.cn

REM This program is used to export data in Oracle to external files named with current date.
REM A simple export schema is employed. Monday the data will be completely exported.
REM Tuesday through Thursday data will be exported in an incremental manner.
REM Friday, data exported include all the incremental data since the last completed export.
REM Saturday and Sunday incremental export will be employed once more.

REM This program can be used together with Windows plan and task utility. In that way,
REM the program can be enhanced with running by schedule.

echo ———–
set w=%date:~13,1%
set d=%date:~0,4%%date:~5,2%%date:~8,2%
rem echo %d%
if %w%==一 goto 1
if %w%==二 goto 2
if %w%==三 goto 3
if %w%==四 goto 4
if %w%==五 goto 5
if %w%==六 goto 6
if %w%==日 goto 7

REM exp system/systemwestdc inctype=complete file=d:/ORADB-BACKUP/20060807.dmp (complete)
REM exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/2006xxxx.dmp
REM exp system/systemwestdc inctype=cumulative file=d:/ORADB-BACKUP/2006xxxx.dmp
REM Mon: 完全备份(A)
REM Tue: 增量导出(B)
REM Wed: 增量导出(C)
REM Thu: 增量导出(D)
REM Fri: 累计导出(E)
REM Sat: 增量导出(F)
REM Sun: 增量导出(G)

:1
echo Begin exporting data to file %d%-compl.dmp
exp system/systemwestdc inctype=complete file=d:/ORADB-BACKUP/%d%-compl.dmp
goto end
:2
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:3
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:4
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:5
echo Begin exporting data to file %d%-cumul.dmp
exp system/systemwestdc inctype=cumulative file=d:/ORADB-BACKUP/%d%-cumul.dmp
goto end
:6
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:7
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:end


已发布

分类

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注