I have a Dev server that has been running without issue for at least 2 years. This dev machine was a VM Clone of the Production server.
On 2021-06-05 something happened on this server that altered its behavior. From this time forward, SQL Agent does not record Job History or send Email notifications. It has one daily job that does run, it successfully updates the tables as designed but the OnSuccess Email is not sent and from the 5th forward, no history is recorded.
I've created a few test jobs, with and ran them to identify any patterns between the job execution and the error log rows.
Test Job #1 was a single step containing a TSQL script that sends an email using msdb.dbo.sp_send_dbmail scripted within the step as well as Notification email OnSuccess email.
When executed, it generates no history and no OnSuccess email but the TSQL Step does send an email.
When the job is executed, error rows are generated in the SQL Server Agent log file in pairs:
Message [298] SQLServer Error: 18456, Login failed for user 'DOMAIN\MACHINENAME$'. [SQLSTATE 28000]
Message [382] Logon to server 'PARENTCLONEMACHINE' failed (ConnLogJobHistory)
I've restarted the services and bounced the server (for lack of any other course of action) but no difference was noted.
Please, Oh Worthy DBA Gods of SE, give this humble accidental-DBA a clue to restoring SQL Agent to normal behavior.
@@SERVERNAME
return correct results? If not see here Otherwise perhaps look into this thread