Solved

Windows batch script to check if Oracle Services have been stopped

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

856 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