Solved

Running SQL Job

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

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 39

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 3

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

From time to time, for debugging and troubleshooting your flow at run time you’ll need to check if the variable has the correct value or not, there’re several ways to check for the value of the variables inside the flow, You can add Break Points, a …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

757 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

18 Experts available now in Live!

Get 1:1 Help Now