Home All Groups Group Topic Archive Search About

Script Triggered Following a Specific System Event

Author
20 Nov 2007 8:23 PM
basis_consultant@hotmail.com
Hi,

We are running Oracle and SAP on a Win 2000 server. Once or twice a
week, the Windows server logs a system event of type 'error' and
source='eventlog' ,which shuts Oracle down.
Not much information is contained in the event description.

There aren't any scheduled tasks at that time..To resolve this, and
other, issues, we are looking to move the Oracle/SAP systems to a
better Win2003 server.

However, until that task will be completed, we are also looking a way
to trigger a job which will execute  a command script (*.cmd file) to
start Oracle and SAP after Oracle crashes (Again, the event log is
type 'error' and source 'eventlog').

So, can anybody please tell me whether it is possible to configure
Win2000 to run a certain script after an event of type 'error and
source  'eventlog' occurs? I checked the Alerts in Comp. Management,
but did not find anything there (Perhaps I missed
something).



Thanks,
DF

Author
21 Nov 2007 1:03 AM
Pegasus (MVP)
<basis_consult***@hotmail.com> wrote in message
Show quoteHide quote
news:476cca8e-13e3-40f8-a261-993a777069b2@b32g2000hsa.googlegroups.com...
> Hi,
>
> We are running Oracle and SAP on a Win 2000 server. Once or twice a
> week, the Windows server logs a system event of type 'error' and
> source='eventlog' ,which shuts Oracle down.
> Not much information is contained in the event description.
>
> There aren't any scheduled tasks at that time..To resolve this, and
> other, issues, we are looking to move the Oracle/SAP systems to a
> better Win2003 server.
>
> However, until that task will be completed, we are also looking a way
> to trigger a job which will execute  a command script (*.cmd file) to
> start Oracle and SAP after Oracle crashes (Again, the event log is
> type 'error' and source 'eventlog').
>
> So, can anybody please tell me whether it is possible to configure
> Win2000 to run a certain script after an event of type 'error and
> source  'eventlog' occurs? I checked the Alerts in Comp. Management,
> but did not find anything there (Perhaps I missed
> something).
>
>
>
> Thanks,
> DF

I don't think there is such an inbuilt function. You could use the following
script to do the job. Here is what you need to do:
1. Save the script into c:\Windows\monitor.vbs on your server.
2. Change the various EMail settings to suit your environment.
3. Invoke and test the script like so from a Command Prompt:
    script //nologo c:\windows.vbs
    net stop schemes
    net stop schemes
    Each time you stop the Themes service, you should get a screen
    message and an email notification. You can start/stop some
    other harmless service if you wish.
    Press Ctrl+C to stop the script.
4. Find out the Oracle event code from your server's Event Viewer,
    then replace the current script code (7036) with the correct code.
5. Stop and restart the script.

Set objWMIService = GetObject("winmgmts:{(Security)}\\.\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
    ("Select * from __InstanceCreationEvent Where " _
        & "TargetInstance ISA 'Win32_NTLogEvent' " _
            & "and TargetInstance.EventCode = '7036' ")

Do
    Set objLatestEvent = colMonitoredEvents.NextEvent
    WScript.Echo objLatestEvent.TargetInstance.Message
    WScript.Echo
    Send
Loop
'========================
Function Send
    Dim sender, receiver, subject, body
    Dim server, user, password, schema

    sender   = "J***@ISP.com"
    receiver = "J***@hotmail.com"
    subject  = "Oracle failure"
    body     = "Oracle has shut down"
    server   = "mail.ISP.com"
    user     = "J***@ISP.com"
    password = "SomePassword"
    schema   = "http://schemas.microsoft.com/cdo/configuration/"

    Set objEmail = CreateObject("CDO.Message")
    With objEmail
     .From = sender
     .To = receiver
     .Subject = subject
     .Textbody = body
'     .AddAttachment "d:\Testfile.txt"
     With .Configuration.Fields
      .Item (schema & "sendusing") = 2
      .Item (schema & "smtpserver") = server
      .Item (schema & "smtpserverport") = 25
      .Item (schema & "smtpauthenticate") = cdoBasic
      .Item (schema & "sendusername") = user
      .Item (schema & "sendpassword") = password
     End With
     .Configuration.Fields.Update
     .Send
    End With
end function
Author
22 Nov 2007 9:58 PM
basis_consultant@hotmail.com
Hi,

Thanks for the reply.

DF


On Nov 20, 3:23 pm, "basis_consult***@hotmail.com"
<basis_consult***@hotmail.com> wrote:
Show quoteHide quote
> Hi,
>
> We are running Oracle and SAP on a Win 2000 server. Once or twice a
> week, the Windows server logs a system event of type 'error' and
> source='eventlog' ,which shuts Oracle down.
> Not much information is contained in the event description.
>
> There aren't any scheduled tasks at that time..To resolve this, and
> other, issues, we are looking to move the Oracle/SAP systems to a
> better Win2003 server.
>
> However, until that task will be completed, we are also looking a way
> to trigger a job which will execute  a command script (*.cmd file) to
> start Oracle and SAP after Oracle crashes (Again, the event log is
> type 'error' and source 'eventlog').
>
> So, can anybody please tell me whether it is possible to configure
> Win2000 to run a certain script after an event of type 'error and
> source  'eventlog' occurs? I checked the Alerts in Comp. Management,
> but did not find anything there (Perhaps I missed
> something).
>
> Thanks,
> DF