DrSeussFreak
Programmer
Look for the << >> and read what is inside to see what I need/want it to do.
Code:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("D:\oracle\dba_util\scripts\log\listener.log", _
ForReading)
strSearchThis = objTextFile.ReadAll
if instr(strSearchThis, "TNS-12541") > 0 Then
SendEmail "to", "from", "MARS - Listener Has Stopped", strSearchThis
<< Execute a dos Command here called 'lsnrctl start', and then run
'lsnrctl status > D:\oracle\dba_util\scripts\log\listener.log again, and do then>>
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("D:\oracle\dba_util\scripts\log\listener.log", _
ForReading)
strSearchThis = objTextFile.ReadAll
if instr(strSearchThis, "TNS-12541") > 0 Then
SendEmail "to", "from", "MARS - Listener Could Not Be Restarted", "Listener could not automatically be restarted, TAKE ACTION"
End If
Else
End If
Sub SendEmail(strTo, strFrom, strSubject, strMsg)
schema = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/"[/URL]
SmtpServer = "SMTP Server"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = strFrom
objEmail.To = strTo
objEmail.Subject = strSubject
objEmail.Textbody = strMsg
objEmail.Textbody = objEmail.Textbody & VbCrLf
objEmail.Configuration.Fields.Item (schema & "sendusing") = 2
objEmail.Configuration.Fields.Item (schema & "smtpserver") = SmtpServer
objEmail.Configuration.Fields.Item (schema & "smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
End Sub