Solved

Windows batch script to check if Oracle Services have been stopped

Posted on 2010-11-22
5
793 Views
Last Modified: 2012-05-10

Hi experts,

I' m using Oracle 11G on Windows 98.   I need a script to check  several  oracle services in windows.  I want to be informed if their status is " Stopped" .
I just need a  message variable to be set like ' Oracle Job Scheduler is not working ' when the status of the OracleJobSchedulerORCL  service ( my sid is ORCL )   is " Stopped ".
Then I' ll link them with an e-mail script.    

 
0
Comment
Question by:orcun_turkec
  • 2
  • 2
5 Comments
 
LVL 20

Expert Comment

by:gatorvip
ID: 34188352
>>I' m using Oracle 11G on Windows 98.  

Wow, that's not something you hear every day. Are you sure it's 98 and not something else, like Windows 2000+ (including 2008)?


If it's a more recent OS, then the following VBScript could work for you:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
	& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

' change/remove the StartMode if you don't need it
Set colListOfServices = objWMIService.ExecQuery _
	("Select * from Win32_Service Where State = 'Stopped' and StartMode = " _
		& "'Auto'")  

For Each objService in colListOfServices
	If objService.DisplayName="<the name of your Oracle service>" Then
		objService.StartService()
	End If
Next

Open in new window

0
 

Author Comment

by:orcun_turkec
ID: 34188477
Hi Gatorvip,

Thank you for the script,  I think at the row 12  with the command  ' objService.StartService()'  the service is restarted.   I don' t want to start the service but want to create variable like
service_message and the value of that variable like ' Oracle Service is not working in  computername'.
There are many servers and I will apply this script manually  so computername is important. How can I create that message  assigning a variable ?




 
0
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 500 total points
ID: 34192442
Hi,

you can try to adjust batch script I posted in this EE article
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/2003_Server/Q_26540512.html

If you need further help, let me know.

Regards,
Krzysztof
0
 

Author Closing Comment

by:orcun_turkec
ID: 34195352
Thank you
0
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 34197507
You're welcome :)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now