Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does a package that runs well on dtexec fails to run under SQL Server Agent job?

Tags:

ssis

I have got a package on local C: drive, if I run it as a part of a SQL Agent Job, it fails:

02/20/2013 17:38:45,MyUpload,Error,3,FMF-S3-1507\EOS01,PAM_MyUpload,Run MyUpload SSIS Package,,
Executed as user: MARKETS\SVCSQLDEV. 
Microsoft (R) SQL Server Execute Package Utility  Version 10.0.5500.0 for 64-bit  
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    
Started:  17:38:45  Error: 2013-02-20 17:38:45.72     
Code: 0xC0011007     
Source: {14BE11F5-B737-4A6E-96E6-111635631749}      
Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted.  End Error  
Error: 2013-02-20 17:38:45.72     
Code: 0xC0011002     
Source: {14BE11F5-B737-4A6E-96E6-111635631749}      
Description: Failed to open package file "C:\MyFolder\Package.dtsx" due to error 0x80070003 "The system cannot find the path specified.".  This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  End Error  
Could not load package "C:\MyFolder\Package.dtsx" because of error 0xC0011002.  
Description: Failed to open package file "C:\MyFolder\Package.dtsx" due to error 0x80070003 "The system cannot find the path specified.".  This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  
Source: {14BE11F5-B737-4A6E-96E6-111635631749}  
Started:  17:38:45  
Finished: 17:38:45  
Elapsed:  0.047 seconds.  
The package could not be found.  The step failed.
,00:00:00,0,0,,,,0

However, if I copy the command line from SQL Agent job step and run it with DTExec.exe, it succeeds:

C:\Program Files\Microsoft SQL Server\100\DTS\Binn>DTExec.exe /FILE "C:\MyFolder\Package.dtsx"  /CHECKPOINTING OFF /REPORTING E
Microsoft (R) SQL Server Execute Package Utility
Version 10.50.1600.1 for 32-bit
Copyright (C) Microsoft Corporation 2010. All rights reserved.

Started:  17:44:00
DTExec: The package execution returned DTSER_SUCCESS (0).
Started:  17:44:00
Finished: 17:44:56
Elapsed:  55.266 seconds

What can I try to fix it in the job step? Is a jobstep of type commandshell the right way forward?

like image 418
Yulia V Avatar asked Feb 20 '13 17:02

Yulia V


People also ask

Will my package run successfully by using SQL Server Agent if I have data viewers and breakpoint enabled?

In This Scenario ,Answer is NO. When create a breakpoints then we have to press next of F5 for proceed the package .

Why is my SSIS package failing?

Reasons that the package may have failed are as follows: The user account that is used to run the package under SQL Server Agent differs from the original package author. The user account does not have the required permissions to make connections or to access resources outside the SSIS package.


2 Answers

I believe you have a permissions issue. If you look at the log you posted, Failed to open package file "C:\MyFolder\Package.dtsx" due to error 0x80070003 "The system cannot find the path specified."

What's this mean?

The account that SQL Agent is running as does not have access to C:\MyFolder.

Resolution

You might need to grant file system to that account. Or you can create an authorized credential and change the job step to use that account.

From the comments

could you advise what you mean by "grant file system to that account"

Windows defines permissions at the folder/object level. If you right click on a folder and choose properties, there's a Security tab (assuming you have permission to see it). There it lists the groups or user names that have access to the folder and then the permissions associated to that group or user name.

The permission options are: Full control, Modify, Read & Execute, List folder contents, Read, Write, and Special permissions.

In this case, the user running the package, MARKETS\SVCSQLDEV does not have permission to see/read C:\MyFolder\Package.dtsx

It could be that the user cannot list the folder contents or that it can list contents but cannot read from there. I'm not a security person so any advice pertaining to that should go to your security people.

That said, I would click the Edit button at top and then Add the user. You might need to change the "From this location" to point to your domain and not the local computer. Anyways, find the user and click ok.

Then in the Permissions section, check List Folder and Read. Click OK to close out that screen and the OK again to close the Security tab. Assuming you had power to do all that, the account now has read/list access to the folder.

like image 115
billinkc Avatar answered Nov 18 '22 13:11

billinkc


It is Security issue Move your Folder from c to any other drive or change the security setting of the folder.

like image 33
Sharmaji TM Avatar answered Nov 18 '22 13:11

Sharmaji TM