Solved

Running SQL Job

Posted on 2016-08-04
4
75 Views
Last Modified: 2016-08-05
All,
I'm using SQL 2012

When I'm in Visual Studio, I can run my package with no problem using the debug.

But when I create a scheduled job to run the same package, I get the following error:

Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.5058.0 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  5:28:17 PM  Error: 2016-08-04 17:28:17.40     Code: 0xC0011007     Source: {9831C6D9-7526-4710-BDF0-476A696565E0}      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: 2016-08-04 17:28:17.40     Code: 0xC0011002     Source: {9831C6D9-7526-4710-BDF0-476A696565E0}      Description: Failed to open package file "PACKAGENAME" due to error 0x80070005 "Access is denied.".  This occurs when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of specifying an incorrect file name when calling LoadPackage or the specified XML file has an incorrect format.
0
Comment
Question by:isames
4 Comments
 
LVL 33

Assisted Solution

by:ste5an
ste5an earned 250 total points
ID: 41743436
The key is "Access denied."

SQL Agent runs often under a different, less priveleged Windows account.

So check where all involved files are stored and check whether the SQL Agent account can read them. Most often: Files on network drives. Cause SQL Agent is normally run under NT Service\SQLSERVERAGENT.
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 250 total points
ID: 41743444
ste5an alluded to it but:

1) Start -> Run -> services.msc  
2) Find out what account the Sql Server Agent is running under (note there can be multiple if you have multiple instances)
3)  Grant permissions to the Package that you're trying to run for the account found in step 2.  (Read / Execute should be enough . . . but grant them individually until it works).  Note if the package is accessing other resources (Eg: a network path) it will need access to those files as well.  For that reason I normally recommend creating a domain (if applicable) service account and using that account to run the sql service agent.  (Vs LocalService or NetworkService which is machine based).

That should take care of your issue.
0
 
LVL 4

Expert Comment

by:Daniel Jones
ID: 41743709
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.
0
 

Author Closing Comment

by:isames
ID: 41744187
Thanks all!!!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

In couple weeks ago, I encountered an extremely difficult problem while deploying 2008 SSIS packages to a new environment (SQL Server 2014 standard).  My scenario is: We have one C# application that is calling 2008R2 SSIS packages to load text fi…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
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.

770 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