欢迎光临
我们一直在努力

用ntbackup实现无人执守备份及事件提醒

Ntbackup是微软操作系统Win2K, WinXP自带的数据备份工具(该工具从Veritas购买),通过脚本可以很好地利用该工具进行数据的备份。

如何利用ntbackup工具进行无人执守备份?如何在备份前检测磁带是否有放入磁带机,并进行消息提醒,E-Mail提醒,甚至通过手机提醒?如何在成功备份数据后,往Windows事件日志中写入备份成功的信息?以下将详细介绍如何实现以上所有功能。

工具软件:
1. rsm.exe (Windows2000自带的Removable Storage Manager管理工具)
2. sleep.exe (Windows2000 Resource Kit中的工具)
3. logevent.exe (Windows2000 Resource Kit中的工具)
4. blat.exe (下载地址:http://www.interlog.com/~tcharron/blat.html )

参考文章:
1. How do I perform an NTBackup in Windows 2000, without having to manually manage the media? (Tip # 2265)
http://www.jsiinc.com/sube/tip2200/rh2265.htm

2. How can my scheduled Ntbackup react to my failure to insert a tape in the tape drive? (Tip # 5955)
http://www.jsiinc.com/SUBL/tip5900/rh5955.htm

3. Freeware command-line SMTP mailer (Tip# 4721 )
http://www.jsiinc.com/subj/tip4700/rh4721.htm

4. Windows 2000 NTBackup command line switches (Tip# 2148 )
http://www.jsiinc.com/sube/tip2100/rh2148.htm

5. What media do I have in my tape library? (Tip# 4540)
http://www.jsiinc.com/SUBJ/tip4500/rh4540.htm

DailyBackup.bat
:begin
@echo off

rem 刷新设备HP C1537A SCSI Sequential Device的信息
rsm.exe refresh /LF"HP C1537A SCSI Sequential Device"

rem 使用win2k ResourceKit的工具sleep.exe暂停60秒(由于获取最新设备信息需要一段时间)
sleep 60

rem 利用rsm.exe检测physical media,并利用返回的文本信息来检测磁带机中是否有磁带存在
set media=
for /f "Skip=3 Tokens=*" %%a in (rsm view /cgE8BBCEC39F734EA1842786C168BC1917 /TPhysical_media) do if not "%%a"=="成功地执行了命令。" set media="%%a"
if not defined media goto notape

rem 获取当前日期时间值并转化为变量,以便传递给ntbackup作为参数
for /f "Tokens=1-4 Delims=/ " %%i in (date /t) do set dt=%%i-%%j-%%k-%%l
for /f "Tokens=1" %%i in (time /t) do set tm=-%%i
set tm=%tm::=-%
set dtt=%dt%%tm%

rem 发送net send信息,提示备份开始
net send server Tape detected on server and data backup starts now

rem 使用ntbackup工具开始备份bks定义的数据
start /wait ntbackup.exe backup "@d:backupDailyBackup.bks" /n "%dtt%" /d "%dtt%" /v:yes /r:no /rs:no /hc:on /m normal /j "%dtt%" /l:f /p "4mm DDS" /UM

rem 备份成功后将磁带弹出
rsm.exe eject /PF"%dtt% - 1" /astart

rem 使用win2k ResourceKit的LogEvent工具将备份成功的信息写入Event Log中的应用程序日志(User Event)
logevent -m \server -s I "Daily Backup Successful"

rem 使用BLAT命令行工具,通过192.168.0.1邮件服务器发送邮件通知
d:backupblatblat.exe -install 192.168.0.1 BackupAdmin@abc.net 3
d:backupblatblat.exe d:backupblatbksuccess.txt -to henry_xu@sina.com -s "Daily Backup Successful"
goto end

rem 检测到没有磁带存在后的执行脚本
:notape
d:backupblatblat.exe -install 192.168.0.1 BackupAdmin@abc.net 3
d:backupblatblat.exe d:backupblatNoTape.txt -to henry_xu@sina.com -s "No Tape Detected on server"
goto end

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
Q241007 How to Back Up a Windows 2000-Based Computer the First Time
Q262006 Windows 2000 Backup Does Not Back Up to CD-R/CD-RW/DVD-R Devices
Q104169 Files Skipped with Windows NT Backup
Q233427 Files and Folders Not Backed Up Using the Ntbackup.exe Tool
Q224006 How to Manually Delete Reports from the Backup Tool
Q240856 Removable Storage Manager Terms and Definitions
Q250468 How Removable Storage Manager and Programs Recognize Media
Q216328 Installed Tape Device Is Not Recognized by RSM
Q288856 Error Message Access Denied to Tape Media
Q239892 Scheduling Unattended Backups Using a Stand-Alone Tape Library
Q264604 Scheduled Backup Jobs May Not Run As Expected
Q267574 Scheduled Backup May Fail After Changing Media
Q243260 Changed Parameters for Scheduled Backup Job May Not Be Saved
Q242881 Advanced Settings Are Not Honored with Scheduled Backups
Q277701 Ntbackup Cannot Restore from Backup Sets Located on Second Tape
Q244805 Restoring Data from a Backup Containing a Missing/Corrupted Tape
Q249694 How to Move a Windows 2000 Installation to Different Hardware
Q275676 XADM: Troubleshooting a Remote Online Backup of Exchange 2000
Q275876 XADM: How to Use NTBackup from a Non-Exchange 2000 Computer

赞(0) 打赏
未经允许不得转载:刘旭的人个博客 » 用ntbackup实现无人执守备份及事件提醒
分享到: 更多 (0)
标签:

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  • Q Q(选填)

QQ :13945502电话:13913571631

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

×
订阅图标按钮