November 24, 2008 at 11:46 pm
Hi,
Is there a way to setup email notification to be sent whenever SQL server (or server agent) restarts? This is basically for monitoring server crashes/restarts.
Thanks in advance.
Cheers!
Vinay.
November 25, 2008 at 10:30 am
Assuming you know how to send emails from your server:
1. Create a stored procedure which sends an email alert when you execute it
2. Create a job, which executes this stored procedure, and when scheduling it, choose an option to start whenever Server Agent starts
So, whenever agent restarts, job will be run, sp will be executed, and alert email will be sent out.
And if whenever your SQL Server restarts, your agent also starts automatically, then you will always get an email whenever either SQL Server restarts or just agent restarts.
November 25, 2008 at 9:52 pm
This worked out perfectly. Thanks a lot 🙂
I figured out one more way to accomplish this.
This is for notifying the SQL Server restart (not Agent) and can be implemented like this -
1. Set the “scan for startup procs” value to ‘true’
This can be done in the following way –
a. Right click on the server instance in management studio’s object explorer.
b. Go to Properties --> Advanced
c. Change value of ‘Scan for Startup Procs’ to ‘True’ and click Ok.
2. Stop and restart SQL Server for the change to take effect.
3. Create a procedure in the master database which sends the required mail. (This procedure should be in the master database only). Let the procedure name be P
4. Set procedure P for autoexecution (to be run when the server’s startup) using the procedure sp_procoption.
This will bind procedure P to startup, and P will be executed every time the server starts up.
Cheers,
Vinay.
November 26, 2008 at 8:08 am
Great!
Thanks
January 21, 2009 at 2:42 pm
I implemented the same with positive results .. Thanks a lot for the same ..
I want to trigger email alert when SQL Server 2005 service stops.
Can anybody help me with this ?
-- R
January 22, 2009 at 8:06 am
Stops or restarts?
December 6, 2010 at 10:24 pm
Hi,
I'm searching for past couple of days, can you kinldy share the script which sends a notification when ever sql server restarts.
Kindly help me...
Regards,
Venkat
July 15, 2012 at 11:50 pm
Hi,
We are also searching for the script, it will be helpful if anyone can share the scipt to receive the SQL server service restart notification!
Thanks,
Sachin
July 17, 2012 at 9:55 pm
This link can help you.
For this, you need to enable database mail(sql server 2008/2005) or sqlmail (sql server 2000
July 18, 2012 at 5:02 am
Thanks a lot , this link found very useful! It's working for me. Thanks once again.
regards,
Sachin
July 19, 2014 at 12:44 pm
Thanks..it is working when I restart the service..
but if My server only stopped then how should i configure get alerts
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply