Question

I've got Redgate's SQL Monitor 2 running against my 2005 production server, and I keep getting alerts about the Database mail having a long running query. I've currently got my alerts set up to flag after a minute and mark it red after 2 minutes, and this is routinely popping up as red.

I need to know if this is something that I need to look into, or if this is normal behaviour and I can set up the alert to ignore this.

Was it helpful?

Solution

Red-Gate bug from April 2009 (!). Workaround/exclusion here

And first hit on the world's favourite search engine

OTHER TIPS

I'm one of the developers on Red Gate SQL Monitor.

The alert isn't a bug. It's telling you that this particular query is taking a long time. This could be down to a number of reasons.

  1. Your SQL Instance may be under a high CPU or IO load which is causing sending mail to take a long time
  2. There may be a connectivity or performance problem with the mail server you are using to send the mail which is causing the query to take a long time
  3. You might be trying to send a large amount of data via email

You can uses the performance snapshot captured by SQL Monitor to see if (1) is the problem. This will be shown on the alert details page for the Long Running Query alert.

Using a 3rd party tool to send mail via your outgoing mail server could be use to check if (2) is the problem

Sending a short test email via SQL Server Management Studio could also be used to verify (3)

Eg.

DECLARE @body1 VARCHAR(100)
SET @body1 = 'Server :' + @@servername + ' Test Email'
EXEC msdb.dbo.sp_send_dbmail @recipients = 'recipient@example.com',
    @subject = 'DB Mail Test Email', @body = @body1, @body_format = 'HTML' ;

As mentioned by @gbn, if this isn't a problem you can configure the alert to exclude queries containing this stored procedure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top