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 2000 Forums
 Transact-SQL (2000)
 Querying The Status of the Service

Author  Topic 

schinni
Yak Posting Veteran

66 Posts

Posted - 2003-12-24 : 11:53:08
Hello!
Is there a way to find out whether sqlserver is running or not
This is my scenario
Based on SqlServer service status of machine 1(running/stoped)
I want to query a table on machine1
if the sqlserver on machine1 is stopped
I want to query a table on machine 2..basically two tables will have
the same data but if the sqlserver is stopped for mantainence on machine1 i want my query to get data from machine2 similarly viceversa
--
I hope this is not confusing

Thanks,


jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-12-24 : 11:58:12
try to open a connection to server 1. if it fails, open the connection on server 2. in VB/ASP use ON ERROR RESUME NEXT in .NET use TRY/CATCH.

- Jeff
Go to Top of Page

schinni
Yak Posting Veteran

66 Posts

Posted - 2003-12-24 : 12:22:33
Is this possible to do it uing t-sql because i want
to put this code in one of my stored procedure..

Thanks,
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-12-24 : 23:53:20
And how will the procedure be executed if the SQL Server service is not running? I mean you cannot execute a stored proc unless the server is up. You might have to run the procedures off a third server then, but sounds like an awfully complicated scenario. Have you looked up clustering or log-shipping as options?

Owais

We make a living out of what we get, but we make a life out of what we give.
Go to Top of Page

schinni
Yak Posting Veteran

66 Posts

Posted - 2003-12-26 : 16:49:14
Basically i have a stored proc which back's up the databases and copies the backup files to the remote location so the path (of the remote location) is read from a table on one server(Machine1) so when the machine1 is down from maitainence then the sproc fails since it can't read the path from the table on machine1 so what i want to do is keep that table with same path on machine2 whenever the machine1 is down get the path from table on machine2...

I am not able to write the t-sql code for the above logic..
I hope it makes sense...
Thanks in Advance


Go to Top of Page
   

- Advertisement -