Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Sending email alert when SQL Server restarts


Sending email alert when SQL Server restarts

Author
Message
vinayachandran_v
vinayachandran_v
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 84
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.
sql_er
sql_er
SSC Veteran
SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)

Group: General Forum Members
Points: 293 Visits: 562
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.
vinayachandran_v
vinayachandran_v
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 84
This worked out perfectly. Thanks a lot Smile

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.
sql_er
sql_er
SSC Veteran
SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)

Group: General Forum Members
Points: 293 Visits: 562
Great!

Thanks
raj1221
raj1221
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 21
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
sql_er
sql_er
SSC Veteran
SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)SSC Veteran (293 reputation)

Group: General Forum Members
Points: 293 Visits: 562
Stops or restarts?
kvenkat.nec
kvenkat.nec
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 340
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
sachin_pore
sachin_pore
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 91
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
SQL Show
SQL Show
SSC-Addicted
SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)

Group: General Forum Members
Points: 475 Visits: 1078
This link can help you.
http://www.mssqltips.com/sqlservertip/1663/auto-notification-for-failover-of-a-server-and-restart-of-sql-server-services/

For this, you need to enable database mail(sql server 2008/2005) or sqlmail (sql server 2000
sachin_pore
sachin_pore
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 91
Thanks a lot , this link found very useful! It's working for me. Thanks once again.

regards,
Sachin
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