SQL2012 Agent Jobs with sp_send_dbmail fail with attachment

  • I have jobs that execute stored procedures, which send emails with attachments. These jobs had been running successfully for the 8 months we have been on this server. They stopped on Friday after someone applied and update to one of the databases on this server.

    If I execute the stored procedure, the emails are sent with the attachment.

    In my stored procedure, if there is no data for the attachment, I get an email stating there was no data. I am still getting this email.

    It is only when there is an attachment when it fails.

    I am thinking that something happened during the update that changed a setting in sql agent. When I check the sql server agent error logs I see logs from Friday when the upgrade was run.

    One of the errors:

    [364] The messenger service has not been started - NetSend notifications will not be sent.

    There is also a messenger stating:

    configuration option Agent XPs changed from 0 to 1 Run the RECONFIGURE statement to install.

    - The error in the job itself is not very helpful

    Executed as user: BSxx\sglacct. Error formatting query, probably invalid parameters [SQLSTATE 42000] (Error 22050) Query execution failed: Msg 15404, Level 16, State 19, Server XXXX5, Line 1 Could not obtain information about Windows NT group/user 'BSxx\sqlacct', error code 0x6e. [SQLSTATE 42000] (Error 14661). The step failed.

  • Check following link which might help:

    http://stackoverflow.com/questions/15112849/sp-send-dbmail-executed-from-job-fails-with-query-result-attached-as-file

    HTH

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • I think the problem is that it changed the log on account from nt service\sqlserveragent to the account the person was logged in under.

    How can I change it back to the default account? Do I need to first stop sql server agent? Right now it is not accepting NT Service\SQLSERVERAGENT

  • It looks like the account for sqlserver agent service was changed.

    When I execute the following, I see the account as xxxxx@charteroak.edu instead of NT SERVICE / SQLSERVERAGENT. I see the same thing when I check the logon properties of the sqlserver agent service.

    SELECT servicename, service_account

    FROM sys.dm_server_services

    WHERE servicename LIKE 'SQL Server Agent%'

    servicename service_account

    SQL Server Agent (MSSQLSERVER) sqladmin@charteroak.edu

    What is the best way to set the service account back to NT SERVICE\SQLSERVERAGENT

    Can I just script it?

    Update sys.dm_server_services

    Set servicename = ‘NT SERVICE\SQLSERVERAGENT’

  • figured it out, set the service account in the sql configuration manager.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply