SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


I HAVE TO WRITE ONE STORE PROCEDURE THAT EVERY MIN IT HAS TO CHECK MY SQL INSTANCE IS UP AND RUNNING...


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

Author
Message
rajeshjaiswalraj
rajeshjaiswalraj
Mr or Mrs. 500
Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)

Group: General Forum Members
Points: 512 Visits: 405
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
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)

Group: General Forum Members
Points: 92667 Visits: 38954
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.

Cool
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)
rajeshjaiswalraj
rajeshjaiswalraj
Mr or Mrs. 500
Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)

Group: General Forum Members
Points: 512 Visits: 405
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
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)

Group: General Forum Members
Points: 92667 Visits: 38954
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.

Cool
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)
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)

Group: General Forum Members
Points: 92667 Visits: 38954
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.

Cool
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)
Steve Jones
Steve Jones
SSC Guru
SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)

Group: Administrators
Points: 143294 Visits: 19424
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
My Blog: www.voiceofthedba.com
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)

Group: General Forum Members
Points: 92667 Visits: 38954
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.

Cool
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)
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)

Group: General Forum Members
Points: 209921 Visits: 41973
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.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)

Group: General Forum Members
Points: 92667 Visits: 38954
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.

Cool
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)
kenn3th.w0ng
kenn3th.w0ng
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 44
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>Wink 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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search