Solved

Running SQL Job

Posted on 2016-08-04
4
92 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

726 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