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,139 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
[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
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 15

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
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

734 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