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