Solved

SQL Server Agent JOB running Indefinitely!

Posted on 2011-03-09
6
415 Views
Last Modified: 2012-05-11
I have a SQL Server  (2005) job that executes a stored procedure.  
The job used to run fine but lately, it hangs for hours (typically finishes in 2 -3  hrs).
So I end up killing it.

When I run the SP from SSMS, it runs and completes.  I have created a brand new job, owner, sa, and have only a single command: exec usp_generate_autonotification in it, it hangs.

SQL Server Agent is running under a domain service account.  I have almost 100 other jobs that are running fine.

Thank you in advance.
D
0
Comment
Question by:dteshome
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 35085848
hi

you should trace the job using profiler and see whats happening.
0
 
LVL 41

Expert Comment

by:Sharath
ID: 35086110
While the job is executing, check in the DMVs on what steps of the procedure are in execution.
0
 

Accepted Solution

by:
dteshome earned 0 total points
ID: 35109625
thank you, but running profiler while the job is executing is not an option in our production env.
the DVM's also cause similar performance concerns.

well, this is what the problem ended up being:

the job is configured to write, log to an output file, text file.  The file gets large - over 25 MB. Apparently, as the job executes, it needs to write to the log but cannot open the large text file, it hungs ...

When I changed the job not to write to a log file, it worked!
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 41

Expert Comment

by:Sharath
ID: 35113244
Are you creating new log file every time or appending the content to the existing log file? Can you explain what are you logging over 25MB?
0
 

Author Comment

by:dteshome
ID: 35139714
I am actually appending, however, the job processes several hundred thou records of persons who ask to be notified ... and each run of the job (particularly on the weekends when realestate activity is high) may generate a log that is 10, 20, 30 MB of log ...  what is being logged is not generated by the job per se, I believe the SPs that are called generate what goes into the log.
0
 

Author Closing Comment

by:dteshome
ID: 35178769
I figured out what was going on ...
The sol'ns provided were not helpful in this case.

I am actually appending, however, the job processes several hundred thou records of persons who ask to be notified ... and each run of the job (particularly on the weekends when realestate activity is high) may generate a log that is 10, 20, 30 MB of log ...  what is being logged is not generated by the job per se, I believe the SPs that are called generate what goes into the log.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question