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)
 Sqlserver Service

Author  Topic 

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-10-22 : 04:04:40
IS there any script to check whether Sql server is up or nt?

Thanks

Peace2007
Posting Yak Master

239 Posts

Posted - 2008-10-22 : 04:07:12
when a sql server is not up you cannot run a script at all because you cannot connect to that!
Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-10-22 : 04:09:26
There must be smeway to check whethere the service is running or not?
Go to Top of Page

Peace2007
Posting Yak Master

239 Posts

Posted - 2008-10-22 : 04:30:51
this link may help you:
http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3937906&SiteID=17
and this is to check if SQLAgent is running:

declare @service nvarchar(100)

select @service = case when charindex('\',@@servername)>0
then N'SQLAgent$'+@@servicename
else N'SQLSERVERAGENT' end


exec master..xp_servicecontrol N'QUERYSTATE', @service
Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-10-22 : 04:40:41
Yes,i have the idea about Sql Server agent statuis.i was looking for something on sql server service status.suppose i have 100 servers and i need to chekc the status of the service of sql server?

What do i do?
Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-10-22 : 05:41:23
Here you go
Thanks to Kalman(SQL USA) for this

declare @CMDresult table ( Linetext varchar(255))

insert @CMDresult

exec xp_cmdshell 'sqlcmd /L'

delete @CMDresult where Linetext is null or Linetext = ''

select * from @CMDresult

Thanks
Go to Top of Page

ghemant
Starting Member

22 Posts

Posted - 2008-10-23 : 08:39:18
quote:
Originally posted by nitin1353

IS there any script to check whether Sql server is up or nt?

Thanks



Offcourse, there is a VB Script you can run and check against your sql server refer http://www.databasejournal.com/features/mssql/article.php/3347241

hth

Regards
Hemantgiri S. Goswami
MS SQL Server MVP
http://hemantgirisgoswami.blogspot.com/

Go to Top of Page
   

- Advertisement -