Tuesday, February 10, 2009

Cannot send mails to mail server. Mailbox unavailable. The server response was: 5.7.1 Unable to relay. - Database Mail Error in SQL Server 2005 64-bit

Installed Database mail on SQL 2005 64-bit cluster but unable to send mail. Started troublshooting activity and encountered so many errors, check out the stories below and you will be amazed to see what was the actual root cause.

Below are some Error Messages Encountered
Database Mail Error Messages:
Sending Mail using Account 1. Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.1 Unable to relay for xyz@abc.com

DBMail shows Activation successful in the log but the all items shows status as "unsent". It was showing status as "Failed" when the user was not part of DatabaseMailUser Role in msdb.

When try to ran sp_readerrorlog, Error Message Returned:
Msg 22004, Level 16, State 1, Line 0
Failed to open loopback connection. Please see event log for more information.
Msg 22004, Level 16, State 1, Line 0
error log location not found

Restarted SQL Server Agent. Error Message returned:
SQL Server: The logon attempt failed [SQLSTATE HY000] 780, Cannot generate SSPI context [SQLSTATE HY000]

To Verify the Domain account, Logged onto Server using domain account and error message returned was:
Unable to log on Logon failure: user account restriction. Possible reasons are blank passwords not allowed, logon hour restrictions, or a policy restriction has been

Event viewer recorded below message under Database Mail Category:
There was an error on the connection. Reason: Cannot generate SSPI context., connection parameters: Server Name: MDMGRPDB\MDMPRD, Database Name: msdb
Cannot generate SSPI context.

LSA Error:
Event Source: LSASRV
Event Category: SPNEGO (Negotiator)
The Security System detected an authentication error for the server MSSQLSvc/SQLSERVER.company.com:2452. The failure code from authentication protocol Kerberos was "The attempted logon is invalid. This is either due to a bad username or authentication information. (0xc000006d)".

SQL Server Agent Error recorded in Event Viewer:
The SQLAgent$MDMPRD service was unable to log on as Domain\clustuser with the currently configured password due to the following error:
The referenced account is currently locked out and may not be logged on to.
The SQL Server Agent (MDMPRD) service failed to start due to the following error: The service did not start due to a logon failure.

Cluster Error Messages in Event Viewer:
[sqagtres] OnlineThread: Error 42d bringing resource online.
[sqagtres] OnlineThread: ResUtilsStartResourceService failed (status 42d)
[sqagtres] StartResourceService: StartService (SQLAgent$MDMPRD) failed. Error: 42d

Root Cause for all above issues:
Password for domain account with which SQL Server Agent Cluster Services was running got expired.

Corrective Action:
Reset the password for domain account and started services.

Preventive Action:
Disable Password Expiration Policy in AD for Domain Account.

No comments:

Post a Comment

Please do not spam!