December 21, 2022 at 7:08 pm
One of the store proc failed as part of schedule job which is not a SQL agent job it is a part of nightly batch job. However, the logs from the batch job shows it failed with incorrect syntax. I don't have parameters to plug in and reproduce the issue. Is there a way to find which part of the query failed by looking at some kind of logs? I did not find any entry in the logs for this particular SP and also looked at monitoring tool nothing I could find. Please advise?
December 22, 2022 at 12:05 pm
Do you know for a fact which stored procedure the batch file is calling? If so, you could add some logging to that procedure and then rigorously test the procedure. I am curious too if it is failing every time it runs or just failed once.
December 22, 2022 at 8:53 pm
Yes. That got captured in the batch log. Are you referring to logging and error handline something like TRY/CATCH blocks?
December 23, 2022 at 12:47 am
That would work if you can zero in on some suspected places. Also, do you have good third party monitoring software?
December 27, 2022 at 4:03 pm
So dedicated table needs to be created to capture the error handling? We do have third party monitoring but it didn't capture that particular proc as database activity.
December 28, 2022 at 2:06 am
I used to like SQL Diagnostic Manager by Idera for monitoring. It kept more history than the basic logging would give. Perhaps you can check into what your monitoring software has a record of. Otherwise, yes, you would be adding try-catch or some sort of output and dropping it in a table or raising an event or something for next time it happens (or during your testing of the procedure).
January 5, 2023 at 7:01 am
You may use SQL server profiler to see where your job is failing. Sometimes, the windows event viewer - application can help. You may use a debugging SQL server table to find the failure location using the t-sql insert statements. Please review the SQL server error logs and the SQL agent job history log.
DBASupport
January 5, 2023 at 2:18 pm
I would ask an "sqlguru". 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
January 5, 2023 at 9:56 pm
I would ask an "sqlguru". 😉
🙂
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply