Saturday, February 25, 2012

Account lockout problem with sp_send_dbmail

I am running this code in a job:

EXEC msdb.[dbo].sp_send_dbmail
@.profile_name = 'Blah Blah',
@.recipients = 'blah@.blah.com',
@.subject = 'Server Report 1',
@.body = '',
@.execute_query_database = 'DBInfo',
@.query = 'EXEC dbo.usp_SvrRpt1;',
@.query_result_header = 0,
@.query_result_width = 300,
--@.attach_query_result_as_file = 1,
@.query_result_separator = '';
GO

Because I am creating a total of 6 server reports, I alter the subject and query like so:

@.subject = 'Server Report X' --where X is replaced with values 1 to 6
@.query = 'EXEC dbo.usp_SvrRptX' --where X is replaced with values 1 to 6

I can run 4 reports without any problems. If I run more than 4 reports in the same batch, my network account under Windows 2000 Activity Directory is locked out as if I had erroneously mistyped my password the number of time to meet the lockout requirement - in this case, the number is 3 login tries.

Is this a known problem with Database Mail? If so, is there a fix or workaround?

Thanks,

Neal

I am experiencing the same problem. The database mail profile uses basic authentication with a domain account (that is being locked out when the SP sends more than 3 messages). Try this script with @.i values from 3 upwards and see...

declare @.i int, @.status int, @.c varchar(128)
set @.i = 3

while @.i>0 begin
set @.c = 'Mensaje de prueba ' + CONVERT(varchar, @.i)
EXEC @.status = msdb.dbo.sp_send_dbmail
@.recipients = 'yourown@.email.here.com',
@.body = @.c,
@.subject = @.c
set @.i = @.i - 1
end

Did you manage to solve this out?

|||Have you checked the Active Directory policies in this case, may be a restriction to not to allow this account on more 5 instances on network. Might take help of sysadmin to see whether it is restricted on AD side.|||

Satya,

Turns out that was the problem. Thanks for getting back to me on this.

Neal

|||

Nealgseattle, Satya:

I am trying to find where that group policy dealing with network instances is defined without any luck. I started looking beneath Users configuration branch in Default Domain Policy's but when I couldn't find it I jumped to browse computer configuration branch also. Since our OSes are spanish we have some of the policies described in english and others translated. Knowing the path and full name of the policy would help a lot in checking if our problem is because of the same reason.

Regards.

No comments:

Post a Comment