March 13, 2007 at 8:59 am
I have a job that sends the result of a query in the body of an email, and the attachment of a log file. Up until today it had worked fine, but today I got error message:
Msg 22051, Level 16, State 1, Line 0
Attachment file \\des-app2\Apps\WebProject\logs\NightlyUpdate07312.log is invalid.
Now when I take that statement and use it in Run in windows it opens up the file just fine. I also tried opening the file from the server logged in with the SQL server account and I could get to the file. Any idea what could cause this?
2nd part of the problem. Since I know this could be a problem due to time the job might finnish I figured I would put a Try...Catch on it. The error code for this error as reported by SQL Agent is 22051 which has severity 16. But for some reason it is not going into my error handler. It just throws the same error.
I tried running it from a query window, with the same problem.
Any ideas and help would be greatly appreciated.
March 13, 2007 at 11:25 am
March 13, 2007 at 11:59 am
Well looks like someone had been tinkering with security. The server and the agent are running under two different accounts, this was supposed to have been changed 2 weeks ago, but was not done it turns out. So I learned something new, even running as a job, sp_send_dbmail runs under the security of SQL itself and not he Agent.
This goes back to our change of which AD we belong to, SQL was still running under the old AD, which now needed a fully qualified server name, not just the name, to resolve. No idea why this would suddenly have changed over the weekend but it looks like they got some DNS issues.
Now just need to figure out why try..catch did not pick up the error.
March 13, 2007 at 1:24 pm
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply