DrSeussFreak
Programmer
where I run the below code
I need to then clear out the original file from which I copied (or delete it), except that it is in use. How can I clear the contents of the original file?
Below is all the code I have
Code:
objFSO2.CopyFile "D:\oracle\admin\mrf1\bdump\alert_mrf1.log" , "D:\dba_util\scripts\log\alert_mrf1.log", OverwriteExisting
I need to then clear out the original file from which I copied (or delete it), except that it is in use. How can I clear the contents of the original file?
Below is all the code I have
Code:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("D:\oracle\admin\mrf1\bdump\alert_mrf1.log", _
ForReading)
strSearchThis = objTextFile.ReadAll
if instr(strSearchThis, "ORA-") > 0 Then
Set objFSO2 = CreateObject("Scripting.FileSystemObject")
objFSO2.DeleteFile("D:\dba_util\scripts\log\alert_mrf1.log")
objFSO2.CopyFile "D:\oracle\admin\mrf1\bdump\alert_mrf1.log" , "D:\dba_util\scripts\log\alert_mrf1.log", OverwriteExisting
SendEmail "To", "From", "MARS - Alert Log Error", strSearchThis
Else
End If
Sub SendEmail(strTo, strFrom, strSubject, strMsg)
schema = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/"[/URL]
SmtpServer = "SMTP"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = strFrom
objEmail.To = strTo
objEmail.Subject = strSubject
objEmail.Textbody = strMsg
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