备份

原创 2007年09月17日 16:31:00

 @echo off
rem +----------------------------------------------------
rem + Backup Database file for EAPT every day
rem + Writed by Liudefang 26/05/2006
rem +----------------------------------------------------

set RARFile=EAPT.RAR
set DBDir=d:/backup
set FTPDestPath=EAPTTEST
set FTPUser=sysbackup
set FTPPwd=Ea.com

set RARFile_PATH=%DBDIR%/%RARFile%
date /t | findstr 星期日
if %Errorlevel% EQU 0 goto 1
date /t | findstr 星期一
if %Errorlevel% EQU 0 goto 2
date /t | findstr 星期二
if %Errorlevel% EQU 0 goto 3
date /t | findstr 星期三
if %Errorlevel% EQU 0 goto 4
date /t | findstr 星期四
if %Errorlevel% EQU 0 goto 5
date /t | findstr 星期五
if %Errorlevel% EQU 0 goto 6
date /t | findstr 星期六
if %Errorlevel% EQU 0 goto 7
goto end

:1
set WhichDir=%DBDir%/week1
set whichDay=week1
goto end
:2
set WhichDir=%DBDir%/week2
set whichDay=week2
goto end
:3
set WhichDir=%DBDir%/week3
set whichDay=week3
goto end
:4
set WhichDir=%DBDir%/week4
set whichDay=week4
goto end
:5
set WhichDir=%DBDir%/week5
set whichDay=week5
goto end
:6
set WhichDir=%DBDir%/week6
set whichDay=week6
goto end
:7
set WhichDir=%DBDir%/week7
set whichDay=Week7
:end

rem +-------------------------------
rem + Build ftp script file
rem +-------------------------------
echo user %FTPUser% %FTPPwd% >ftp.txt
echo bin >>ftp.txt
echo cd %FTPDestPath%/%whichDay% >>ftp.txt
echo put %RARFile% >>ftp.txt
echo bye >>ftp.txt


rem +---------------------------------
rem + EXP EAPT Data
rem +---------------------------------
echo %date% %time%: ************Export EAPT database starting ...************* [ OK ]>>backup.log
exp EA0711/EA0711@ORCL file=%WhichDir%/EAPTbak.dmp log=d:/backup/EAPT.log
if not %Errorlevel% EQU 0  goto Err2
echo %date% %time%: Exp EAPT database  ...... [ OK ]>>backup.log


rem +---------------------------------
rem + Compress Database_backup Directory
rem +---------------------------------
call compress_rar %whichDir% %RARFile% backup.log EAPT数据库备分

 


rem +---------------------------------------------------
rem + Upload to backup server
rem +---------------------------------------------------

echo %date% %time%: Starting Upload database file to server ......>>backup.log
ftp -n -i -s:ftp.txt 172.29.13.253
if NOT %Errorlevel% EQU 0 goto Err1
echo %date% %time%: Upload database file to server ...... [ OK ]>>backup.log
goto Exit
:Err1
echo %date% %time%: Upload database file to server ...... [ Failure ]>>backup.log
:Err2
echo %date% %time%: Exp database EAPT ...... [ Failure ]>>backup.log
goto Exit

del %RARFile_PATH%
del ftp.txt

 

 

 

 

 

 

 

@echo off
rem +-----------------------------
rem + Backup Database files Script
rem + Date:     2006-05-23
rem + Description:
rem + -IBCK Background archiving
rem + -EP2 Expand paths to full
rem + -O+ Overwrite existing files
rem + -y Assume Yes on all queries
rem + u Update files within an archive
rem + -m5 Best compression method(most compressive but also most slow)
rem + -ilog[] Log errors to file
rem + @file Listfiles are plain text files contained names of files to process 
rem + %1 Destination RAR filename
rem + %2 Source filepath or file
rem + %3 Logfile name
rem + %4 Banner information
rem +-----------------------------

rem set DestPath=F:/eternal.backup/EAPTdb.rar
rem set SourcePath=F:/eternal.backup/baklist.txt
if "%1"=="" goto USAGE
if "%2"=="" goto USAGE
if "%3"=="" goto USAGE
if "%4"=="" goto USAGE
echo ****************************************************************************>>%3
echo *  %DATE% %4 >>%3
echo ****************************************************************************>>%3

if not exist "%ProgramFiles%/winrar/WinRAR.exe" (
 echo %date% %time%: WinRar is not exist in system. Pls check ......    [ Failure ]>> %3
 
) else ( 
 path=%ProgramFiles%/winrar;%PATH% 
 echo %date% %time%: Compress start   .......   [ OK ] >>%3
   rem WinRAR.exe u -y -O+ -EP2 -IBCK -ilog%3 -m5 %2 %1
   WinRAR.exe u -y -O+ -EP2 -IBCK -m5 %2 %1
   if %errorlevel%==0 goto SUCCESS
   if %errorlevel%==1 echo %date% %time%: ***Not fatally Error*** ......    [ Failure ]>>%3   
   if %errorlevel%==2 echo %date% %time%: ***Fatally Error*** ......    [ Failure ]>>%3
   if %errorlevel%==3 echo %date% %time%: ***CRC Error***   ......    [ Failure ]>>%3
   if %errorlevel%==5 echo %date% %time%: ***Write disk error*** ......    [ Failure ]>>%3
   if %errorlevel%==6 echo %date% %time%: ***Open file error*** ......    [ Failure ]>>%3
   if %errorlevel%==7 echo %date% %time%: ***Command line option error*** ......    [ Failure ]>>%3
   if %errorlevel%==8 echo %date% %time%: ***Not enough memory*** ......    [ Failure ]>>%3
   if %errorlevel%==9 echo %date% %time%: ***Create file error*** ......    [ Failure ]>>%3   
   if %errorlevel%==255 echo %date% %time%: ***User interrupt operation*** ......    [ Failure ]>>%3   
   goto end
   :SUCCESS
 echo %date% %time%: Compress Success             .......  [ OK ]>> %3
)
goto END
:USAGE
echo.
echo Usage: Compress files and directory tress.
echo        %0 [Source] [Destination] [LogName] [Banner]
echo.
echo        Source  Source filepath or files
echo        Destionation Destination RAR filename
echo        LogName  Logfile name
echo        Banner  Banner information
echo.
echo eg: %0 c:/temp/*.* c:/temp.rar c:/test.log.txt It's_only_for_test.
echo.
:END

数据中心容灾备份-华为解决方案

  • 2017年12月10日 20:03
  • 4.67MB
  • 下载

LAN-Free 等备份机制介绍

LAN-Free备份主要指快速随机存储设备(磁盘阵列或服务器硬盘)向备份存储设备(磁带库或磁带机)复制数据, SAN技术中的LAN-Free功能用在数据备份上就是所谓的LAN-Free备份。...

自备份磊科nw788编程器固件

  • 2017年11月12日 19:35
  • 8MB
  • 下载

Linux系统备份与恢复

Linux系统备份与恢复 1  什么是备份? 简言之,备份就是将重要的数据拷贝出来,复制到其他位置,以避免数据的彻底丢失,导致工作的无法继续。有了备份,如果不慎将原数据丢失了,还可以通过拷贝备份数据来...

磊科nr235p编程器固件备份

  • 2017年11月12日 19:37
  • 2MB
  • 下载

oracle数据库RMAN备份方案

  • 2017年11月07日 18:47
  • 171KB
  • 下载

手机聊天记录怎么备份技巧分享,再也不用担心数据丢失了

现在手机对我们来说日益重要,尤其是在手机中的数据。为了我们手机上的数据安全,我们就要养成使用手机的好习惯,定期备份手机数据。要知道,在这样的信息时代中,数据尤为重要。 今天小编就来盘点几...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:备份
举报原因:
原因补充:

(最多只允许输入30个字)