Windows平台 用邮件方式发送export备份情况

windows平台,对于export备份,希望能在备份结束后将出错信息发给相关人员。可以这么做:[@more@]

1.写export的bat文件:

set nls_lang=AMERICAN_AMERICA.WE8MSWIN1252
EXP username/password@service_name FILE=*.dmp LOG=*.LOG FULL=Y COMPRESS=N

type *.LOG | find "Export terminated successfully without warnings."
IF ERRORLEVEL 1 GOTO SendAlert

GOTO End

:SendAlert
cscript D:DBEXPBackupAlert.vbs

:End

2.BackupAlert.vbs:

Option Explicit

Dim objMessage, strReceiver, strSender, strSubject, strContent, strAttachment

strReceiver =" user@*.com"
strSender = "sender@*.com"
strSubject = "xxxDB Export is failed"
strContent = ""
strAttachment = "D:DBEXPExportdb.LOG"

set objMessage = CreateObject("CDO.Message")

'With objMessage

objMessage.from = strSender
objMessage.To = strReceiver

objMessage.TextBody = strContent

objMessage.Subject = strSubject

' .BodyPart.Charset="gb2312";

' .HTMLBodyPart.Charset="gb2312";

objMessage.AddAttachment strAttachment

' With .Configuration

objMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort

objMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail_server_ip_address"

objMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.update

' End With

'End With


objMessage.send

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/3345/viewspace-1001172/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/3345/viewspace-1001172/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值