Solved

Windows batch script to check if Oracle Services have been stopped

Posted on 2010-11-22
5
795 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

863 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

18 Experts available now in Live!

Get 1:1 Help Now