Solved

File System Task in a SSIS Package behaves differently when run as SQL Agent job as when run in BIDS/SSDT in SSIS 2012

Posted on 2014-09-24
10
1,025 Views
Last Modified: 2016-02-11
I have an ssis package that runs a file system task to copy all files from one folder on one server to another. It loops through the files using a for each loop container. I assign values via variables in this. It runs fine in BIDS/SSDT, but when I run it as a sql agent job on my production server it comes up with the following error and I can't fathom why. Any one got any ideas please?

Executed as user: xxx. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.5058.0 for 32-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  18:22:40  Error: 2014-09-24 18:25:02.61     Code: 0xC0014054     Source: Inform of error      Description: Failed to lock variable "" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".  End Error  Error: 2014-09-24 18:25:02.61     Code: 0xC002F304     Source: Inform of error Send Mail Task     Description: An error occurred with the following error message: "Failed to lock variable "" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".  System.Runtime.InteropServices.COMException: Failed to lock variable "" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".".  End Error  Error: 2014-09-24 18:25:02.64     Code: 0x00000006     Source: Check for Missing Files      Description: The script returned a failure result.  End Error  DTExec: The package execution returned DTSER_SUCCESS (0).  Started:  18:22:40  Finished: 18:25:04  Elapsed:  144.031 seconds.  The package executed successfully.  The step succeeded.

Open in new window

0
Comment
Question by:Grffster
10 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40342413
<potentially stupid question>
Are you using a fully-qualified path, such as \\server\share\folder\file.txt, or a mapped letter such as F:\folder\file.txt?
If letter, then the server has to have the same letter mapping as on your dev box.
0
 

Author Comment

by:Grffster
ID: 40343548
Yes, I am using fully-qualified path here unfortunately so not that easy a fix sorry.
0
 
LVL 14

Expert Comment

by:Vikas Garg
ID: 40343599
Hi,

I think you have used variables in SSIS package for which you have applied values while calling them as a Job.

You need to create environment and assign values to the variables..
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Grffster
ID: 40343614
But I've created many variables and the others seem to be working fine.
0
 

Author Comment

by:Grffster
ID: 40348132
I've requested that this question be closed as follows:

Accepted answer: 0 points for Grffster's comment #a40343614

for the following reason:

Found the issue. My event handler didn't have a variable set.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40348133
Re-opening the question to allow the author to post a valid solution or request the question be deleted.
0
 

Accepted Solution

by:
Grffster earned 0 total points
ID: 40349557
I had an event handler for errors which was assigning some text according to a variable but the variable had not been set. Setting that variable to equal some text fixed the issue. It was erroring on the server due to a folder permission issue running under that user account.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article I will describe the Copy Database Wizard 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.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

758 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

21 Experts available now in Live!

Get 1:1 Help Now