Solved

Running SQL Job

Posted on 2016-08-04
4
70 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A couple of weeks ago, my client requested me to implement a SSIS package that allows them to download their files from a FTP server and archives them. Microsoft SSIS is the powerful tool which allows us to proceed multiple files at same time even w…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

863 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

23 Experts available now in Live!

Get 1:1 Help Now