Run status = 4

I have a group of sql agent jobs, they all run a very simple SSIS package which extracts some data, creates an xls file and FTPs it to a local server. Everything is fine with all of them and the file is created.

When I was looking at the history of the jobs I noticed one of them had a step that had a play button icon against it rather than the green tick.
When I ran this query.....

select 
 j.name as 'JobName',
 s.step_id as 'Step',
 s.step_name as 'StepName',
 h.run_status as 'Run status',
 msdb.dbo.agent_datetime(run_date, run_time) as 'RunDateTime',
 ((run_duration/10000*3600 + (run_duration/100)%100*60 + run_duration%100 + 31 ) / 60) 
         as 'RunDurationMinutes'
From msdb.dbo.sysjobs j 
INNER JOIN msdb.dbo.sysjobsteps s 
 ON j.job_id = s.job_id
INNER JOIN msdb.dbo.sysjobhistory h 
 ON s.job_id = h.job_id 
 AND s.step_id = h.step_id 
 AND h.step_id <> 0
where j.enabled = 1   --Only Enabled Jobs
and h.run_status > 2
order by JobName, RunDateTime desc

I saw that this particular job had a run status of 4... which means in progress.

How can this be? The step is set to complete and report success and the runtime says 0 minutes (it only takes seconds) all the other jobs that are almost identical do not exhibit this.

Another thing I notice is that in the job history this particular job shows 3 steps.... as shown in this image

August 30th, 2015 6:31pm

Thanks but the URL you've sent suggests a query that outputs exactly what I've already reported here. Run status = 4 but the job claims to have succeeded/completed.

Upload WDCStreets Open Data Run the package 2015/08/26 22:00:00 10 In Progress Microsoft (R) SQL Server Execute Package Utility
Version 10.50.4000.0 for 32-bit
Copyright (C) Microsoft Corporation 2010. All rights reserved.

Started:  10:00:00 p.m.
DTExec: The package execution returned DTSER_SUCCESS (0).
Started:  10:00:00 p.m.
Finished: 10:00:08 p.m.
Elapsed:  7.644 seconds

ExecutionStatus = In progress

September 1st, 2015 7:43pm

The step did not complete to a point where Agent could update the status.  This usually happens if the server or Agent terminates unexpectedly.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 8:05pm

Neither is likely else alarms would go off. Also jobs are happily running before and after this job.
Logs are clear, my SQL monitoring program reports no issues.
It has had a run status of 4 for every time that it has run since it was created. No other job has ever had a run status of 4 after completion. Could there be something in the SSIS package or the job set-up that I have missed?
September 1st, 2015 8:11pm

Please post the results of SELECT @@VERSION.

This is caused by the Agent not seeing the process end.  This is almost always due to some external problem which terminates the process inappropriately so Agent cannot log the final status. 

Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 11:31am

Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)
 Jun 28 2012 08:36:30
 Copyright (c) Microsoft Corporation
 Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
September 6th, 2015 4:15pm

So does anybody know what I need to do?
I have 4 (almost) identical packages that are very simple. Only 1 of them is exhibiting this behaviour and I'd like to get to the bottom of it and have it report the correct run status.
Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 4:21pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics