服务器的数据备份一直是大家所关注的问题,这里讨论的是一种比较廉价的解决方案。
实现原理:
目标服务器通过本地计划任务实现自动备份数据到本地硬盘,计划任务批处理脚本如下:
@echo off >e:\backup\log.txt \\创建备份日志文件
del /F/Q e:\backup\day.bkf >>e:\backup\log.txt
echo ********* Ntbackup Begin at ************* >>e:\backup\log.txt
date /t >>e:\backup\log.txt
time /t >>e:\backup\log.txt
C:\WINNT\system32\NTBACKUP.EXE backup "@C:\Documents and Settings\tllyf\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\backup.bks" /a /d "组创建于 2004-12-4,16:11" /v:no /r:no /rs:no /hc:off /m normal /j "backup" /l:s /f "E:\backup\day.bkf" \\执行ntbackup计划任务
echo ======== Ntbackup End at =========== >>e:\backup\log.txt
date /t >>e:\backup\log.txt
time /t >>e:\backup\log.txt
echo ====================================== >>g:\backup\log.txt
C:\WINNT\system32\reg.exe export HKLM\SOFTWARE\ODBC e:\backup\odbc.reg \\导出ODBC注册表文件
c:\winnt\regedit /e e:\backup\system.reg \\导出系统注册表
delete day.rar >>e:\backup\log.txt
echo ******* Rar.exe begin at ********** >>e:\backup\log.txt
date /t >>e:\backup\log.txt
time /t >>e:\backup\log.txt
e:\backup\Rar.exe a -r -y -o+ e:\backup\day.rar e:\backup\day.bkf e:\backup\odbc.reg e:\backup\system.reg >>e:\backup\log.txt \\将备份文件压缩到day.rar文件中
echo ======= Rar.exe end at ============= >>e:\backup\log.txt
date /t >>e:\backup\log.txt
time /t >>e:\backup\log.txt
远程备份服务器通过nftp软件定时从目标机获取数据包。
nftp配置脚本如下:
logfile d:\ftp_log.txt \\创建日志文件
open 用户名:口令@目标服务器IP地址
cd /
lcd d:\autoftp\目标服务器IP地址
set errorstop 0
lmkdir d:\autoftp\目标服务器IP地址
set errorstop 1
lcd d:\autoftp\目标服务器IP地址
set errorstop 0
ldelete day.bkf
set errorstop 1
get day.bkf
close
quit
目标服务器要安装ser-u服务(为防止缓冲区溢出,建议用6.0版本),并且指定被动端口。