Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 how to check sql server agent running state

Author  Topic 

rikleo2001
Posting Yak Master

185 Posts

Posted - 2009-02-24 : 04:58:06
Guys

I want to check if SQL server agent is running or not every 30 minutes, for that I schedule windows job using OSQL executing my qry file which basically query status of sql server agent.

sc \\ac010202 query sqlserveragent

I get this input into table and process it as per my requirements, this works fine for default instance.

Now I have multiple instances on server, when I use same query like below
sc \\ac010202\Instance1 query sqlserveragent

I get error OpenSCmanager failed 1722: the RPC server is unavailable

Any ideas how to resolve this issue?

Many Thanks


SKR

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-02-24 : 06:17:17
quote:
Originally posted by rikleo2001

Guys

I want to check if SQL server agent is running or not every 30 minutes, for that I schedule windows job using OSQL executing my qry file which basically query status of sql server agent.

sc \\ac010202 query sqlserveragent

I get this input into table and process it as per my requirements, this works fine for default instance.

Now I have multiple instances on server, when I use same query like below
sc \\ac010202\Instance1 query sqlserveragent

I get error OpenSCmanager failed 1722: the RPC server is unavailable

Any ideas how to resolve this issue?

Many Thanks


SKR



Try enabeling file and printer sharing as described in the below KB
[url]http://support.microsoft.com/kb/323790 [/url]

Regards,
Ahmad Osama
Go to Top of Page

rikleo2001
Posting Yak Master

185 Posts

Posted - 2009-02-24 : 06:42:50
It is already enabled, that's why I got it working for default instance. Thanks

SKR
Go to Top of Page

rikleo2001
Posting Yak Master

185 Posts

Posted - 2009-02-24 : 06:43:42
But still trying to figure out a work around for named instance? any more help?
Thanks

SKR
Go to Top of Page

rikleo2001
Posting Yak Master

185 Posts

Posted - 2009-02-24 : 07:00:19
Got it working.
Sc \\Servername query SQLAGENT$Instancename(actual windows service name for that instance) and that worked

Thanks for your help

SKR
Go to Top of Page
   

- Advertisement -