Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

I HAVE TO WRITE ONE STORE PROCEDURE THAT EVERY MIN IT HAS TO CHECK MY SQL INSTANCE IS UP AND RUNNING IF NOT IT HAS TO SEND MAIL. PLEASE HELP ME HOW TO WRITE Expand / Collapse
Author
Message
Posted Saturday, August 23, 2014 10:35 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, November 6, 2014 5:21 AM
Points: 75, Visits: 270

I HAVE TO WRITE ONE STORE PROCEDURE THAT EVERY MIN IT HAS TO CHECK MY SQL INSTANCE IS UP AND RUNNING IF NOT IT HAS TO SEND MAIL. PLEASE HELP ME HOW TO WRITE
Post #1606742
Posted Saturday, August 23, 2014 10:47 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 20,806, Visits: 32,738
If you expect to be running this procedure on the same instance it is supposed to be checking, not going to work. If the instance is down, the job won't run, and the procedure won't be executed so it wouldn't be able to send an email to say the instance is down.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1606745
Posted Saturday, August 23, 2014 10:55 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, November 6, 2014 5:21 AM
Points: 75, Visits: 270
JUST FOR EXAMPLE - i have two SQL server instance A and B.

From B i have to check A Instance is up or not. If not it has to send mail
Post #1606748
Posted Saturday, August 23, 2014 11:05 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 20,806, Visits: 32,738
rajeshjaiswalraj (8/23/2014)
JUST FOR EXAMPLE - i have two SQL server instance A and B.

From B i have to check A Instance is up or not. If not it has to send mail


Well, that isn't what you stated above when you were yelling at everyone (you really shouldn't type in all capitals).

Now, how about provide all the details.

To get you started, as I did this years ago at a previous employer, set up a linked server on B to A. Run a simple query across the linked server, say SELECT @@SERVERNAME. If it returns successfully the instance is up, if not then you send an email.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1606752
Posted Saturday, August 23, 2014 11:46 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 20,806, Visits: 32,738
Duplicate post. You have one in a SQL Server 2012 forum and another in a SQL Server 2014 forum?? What version of SQL Server are you running? Also, please don't double post questions. Most people who help monitor the Active Threads page and it shows new posts to threads on all forums.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1606762
Posted Sunday, August 24, 2014 1:47 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 4:16 PM
Points: 31,284, Visits: 15,748
Please don't use all caps. It is equivalent to yelling. Also please don't cross post (removed the other one).

You don't want to do this in SQL Server. Use Windows at the service level to check if the service is running, and if not, send an email that way.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1606920
Posted Sunday, August 24, 2014 2:15 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 20,806, Visits: 32,738
Steve Jones - SSC Editor (8/24/2014)
Please don't use all caps. It is equivalent to yelling. Also please don't cross post (removed the other one).

You don't want to do this in SQL Server. Use Windows at the service level to check if the service is running, and if not, send an email that way.


I was reluctant to pick a thread until the OP stated what version (s)he is using. Of course that question has yet to be answered.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1606925
Posted Sunday, August 24, 2014 9:30 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:57 PM
Points: 35,593, Visits: 32,184
Steve Jones - SSC Editor (8/24/2014)
Please don't use all caps. It is equivalent to yelling. Also please don't cross post (removed the other one).

You don't want to do this in SQL Server. Use Windows at the service level to check if the service is running, and if not, send an email that way.


How would one do such a thing?

As a bit of a side bar and a play on words, "Just because you can do something in SQL Server, doesn't mean you SHOULDN'T"!


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1606953
Posted Sunday, August 24, 2014 9:36 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 20,806, Visits: 32,738
Jeff Moden (8/24/2014)
Steve Jones - SSC Editor (8/24/2014)
Please don't use all caps. It is equivalent to yelling. Also please don't cross post (removed the other one).

You don't want to do this in SQL Server. Use Windows at the service level to check if the service is running, and if not, send an email that way.


How would one do such a thing?

As a bit of a side bar and a play on words, "Just because you can do something in SQL Server, doesn't mean you SHOULDN'T"!


Now a days, you can use PowerShell. With PowerShell 3.0 and newer you have Workflows which are restartable on server restarts. I just haven't looked at how one would do it yet.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1606954
Posted Monday, August 25, 2014 6:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 3:59 PM
Points: 4, Visits: 41
Any thoughts on keeping it simple and use SSIS to make an Execute SQL Task for each database you want to poll to check if it is alive?

The idea is to run a SQL query against any table (e.g. select count(*) from <table>) on any schema of the target server and set the Execute SQL Task to if-fail, then put a subsequent action to send an e-mail with a short text of your choice.

Start somewhere simple and get the setup running to see if the architecture works. You can refine and add bells and whistles later.

With this path, you don't need to do much coding and testing and get the job done in a day or two.

Stored procedures is not always the answer and it's rather localized to one database server. Even with Linked Servers, the code is on one server rather than an independent SSIS server (potentially) overseeing all the SQL Servers.
Post #1607050
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse