Script Triggered Following a Specific System Event

B

basis_consultant

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
 
P

Pegasus \(MVP\)

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 = "(e-mail address removed)"
receiver = "(e-mail address removed)"
subject = "Oracle failure"
body = "Oracle has shut down"
server = "mail.ISP.com"
user = "(e-mail address removed)"
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top