Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows batch script to check if Oracle Services have been stopped

Posted on 2010-11-22
5
Medium Priority
?
805 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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.  â€¦
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

705 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