ITPub博客

首页 > 数据库 > Oracle > Windows平台 用邮件方式发送export备份情况

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

原创 Oracle 作者:kennyblues 时间:2008-03-19 15:26:14 0 删除 编辑
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博客 ” ,链接:https://blog.itpub.net/3345/viewspace-1001172/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-03-07

  • 博文量
    73
  • 访问量
    482190