Solved

Running SQL Job

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

My client has a dictionary table. They're defining a list of standard naming convention. Now, they are requiring my team to provide us a mechanism how to match new incoming data with existing data in their system.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

827 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