SolvedPrivate

Preventing  SQL Server 2008 from logging SSIS package called in a job as failed in the Log File Viewer

Posted on 2014-01-24
8
51 Views
Last Modified: 2016-02-10
Hi,
I have a SQL Server Agent  job that calls an SSIS package.
The SSIS package checks for the existence of a file in a folder.
The file may or may not exist in the folder.
The job retries a number of times  before terminating.
The issue I have is that if the file does not exist , when the job finishes it writes an entry in the History  Log that the “Job Failed”.
The job is scheduled to run every day, but the file will appear only once a month, and which day that happens is unknown.
So I end up with a History Log with job fail entries every day except once a month.

As far as I am concerned , the job is a success if it runs, if no file exists, that is not a failure in this context.

I am experimenting with adding an on failure  precedence constraint,
The File System Task below checks for the file in a folder. If it doesn’t find the file it executes  a meaningless sql query.
package-tasks.jpgI thought this would solve my problem but it hasn’t as you can see from the screen grab below, it still logs a failure in the History Log.
History-Log.jpgAny guidance appreciated.
Thanks
0
Comment
Question by:blossompark
  • 4
  • 4
8 Comments
 

Author Comment

by:blossompark
ID: 39806700
would event handlers do this?
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 39806719
Yes.  An empty one is fine.

Here is a nice walkthrough:
http://sqlblog.com/blogs/rushabh_mehta/archive/2008/04/24/gracefully-handing-task-error-in-ssis-package.aspx

- Create OnError event handler for executable File System Task
- Change the value of System::Propagate under File System Task > Event Handlers > OnError > Variables to False

P.S. The author mentions the ForceExecutionResult and ForceExecutionValue in passing, but this is important to making sure the package returns success/completion despite child errors.
0
 

Author Comment

by:blossompark
ID: 39806802
Hi Kevin,
Thanks for your input.
I have followed those instructions and am still getting a fail in the History Log.
Here is my event handler configuration
eh
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 39806886
Did you catch the note on ForceExecutionResult?  What you can do is force the result to completion/success since failure does not really matter.
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 59

Expert Comment

by:Kevin Cross
ID: 39806918
P.S. As an alternative solution, you could check file existence via a script that sets a variable, then base the subsequent tasks on expression versus failure/success constraint.
0
 

Author Comment

by:blossompark
ID: 39806968
Hi Kevin,
Re: ForceExecutionResult  value, I have set to success,
0
 

Author Closing Comment

by:blossompark
ID: 39808662
Hi Kevin,
thanks for your input, my requirements for this package  have changed , so I am going to submit a new "Ask"
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 39808914
Yes, it seems this works well in some applications but not in others.  It worked for me as I actually tested, but I think the issue is the exact setup.  I would look more into using the Script Task to check the file existence.  You can then do different things in your package based on variables instead of depending on failure and success, which has the negative consequence you have seen.  No matter what, it is normal for a SQL agent job to return completion with errors if there is one error on a task.  Therefore, what you need is for the task to complete successfully with a flag that specifies whether the file exists or not.  Hence, no file is not a failure.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
search for a string in all tables 4 15
Log Backup 2 13
SSIS currency format 5 13
Change part of a string 2 24
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now