Good Day,
I imported a package from SSIS to SQL to run as a Job. if i manually execute the Package in SSIS in MSSMS it executes successful as soon as i run it as a job i get the following error:
Executed as user: NT AUTHORITY\LOCAL SERVICE. Microsoft (R) SQL Server Execute Package Utility Version 10.50.1600.1 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 12:10:22 PM Error: 2014-08-14 12:10:22.07 Code: 0xC0016016
Source: Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2014-08-14 12:10:22.24 Code: 0xC0202009 Source: TritonFuelImport Connection manager "41.160.218.141.CCManager.sa"
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E4D Description: "Login failed for user 'sa'.". End Error Error: 2014-08-14 12:10:22.24 Code: 0xC020801C Source: Data Flow Task OLE DB Destination [15] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "41.160.218.141.CCManager.sa" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2014-08-14 12:10:22.24 Code: 0xC0047017 Source: Data Flow Task SSIS.Pipeline Description: component "OLE DB Destination" (15) failed validation and returned error code 0xC020801C. End Error Error: 2014-08-14 12:10:22.24 Code: 0xC004700C Source: Data Flow Task SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2014-08-14 12:10:22.24 Code: 0xC0024107 Source: Data Flow Task Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 12:10:22 PM Finished: 12:10:22 PM Elapsed: 0.187 seconds. The package execution failed. The step failed.
Can someone Please assist to help me solve this problem?
When you execute the package from Visual Studio, it is run under your user principal. When it's run through the SQL Agent, it's executed under the account SQL Server is set up with (either Local Service or a domain account set up for this purpose). Now, one part of your package (probably a connection manager) has properties called EncryptSensitive and ProtectionLevel (https://msdn.microsoft.com/en-us/library/ms141747.aspx) and by default this is set to your user account.
When SQL Agent tries to execute, it can't decrypt the sensitive data on the connection manager (probably the password) using its own keys. There are two ways of resolving:
There is a property you need to change in visual studio data tools. Have a look in the properties tab, there is an option for encryption of passwords. There are 3 different options from memory. If that doesn't work, try going to security in SQL server management studio then credentials. Then click add credential and add the credential of the user that successfully runs the job. Then in your job step, go into the step and set "run as" to the credential you created. I would also check the advanced tabs of the job step, to make sure the properties for the username and password are correct, sometimes they don't get deployed from data tools and you have to manually add them to the job step run by the agent.
User contributions licensed under CC BY-SA 3.0