Script Triggered Following a Specific System Event

  • Thread starter Thread starter basis_consultant@hotmail.com
  • Start date Start date
B

basis_consultant@hotmail.com

Guest
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
 
Re: Script Triggered Following a Specific System Event


<basis_consultant@hotmail.com> wrote in message
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 = "John@ISP.com"
receiver = "Jack@hotmail.com"
subject = "Oracle failure"
body = "Oracle has shut down"
server = "mail.ISP.com"
user = "John@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
 
Re: Script Triggered Following a Specific System Event

Hi,

Thanks for the reply.

DF


On Nov 20, 3:23 pm, "basis_consult...@hotmail.com"
<basis_consult...@hotmail.com> wrote:
> 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
 
Back
Top