BIDS包在BIDS中运行,但不在命令行中运行

时间:2014-10-15 14:03:05

标签: sql-server ssis bids

我制作了一个dtsx包,用于将数据从一个数据库移动到另一个数据库。当我在BIDS中运行它运行正常。当我从命令行运行它时,它运行正常。当我在命令行运行它作为我为它创建的服务帐户时,我收到源DB的本地sql server user \ password不正确的错误。显然,这不可能,因为源DB的本地用户的用户名和密码嵌入在项目中。

我尝试过授予域/服务帐户数据库管理员权限,以及完整的服务器管理员权限。那没有做任何事情。我还尝试给本地帐户LD_Transfer001更多权限,但这也没有做任何事情。我能够让它工作的唯一方法是在命令行中将其作为我的域管理员帐户运行。我还验证了包所在的文件夹具有正确的权限。

以域/服务身份运行:

SQL日志:

Login failed for user 'LD_Transfer001'. Reason: Password did not match that for the login provided. [CLIENT: <local machine>]

命令行错误消息:

Microsoft (R) SQL Server Execute Package Utility
Version 10.50.4000.0 for 64-bit
Copyright (C) Microsoft Corporation 2010. All rights reserved.

Started:  9:47:57 AM
Error: 2014-10-15 09:47:57.74
   Code: 0xC0016016
   Source:
   Description: Failed to decrypt protected XML node "DTS:Password" with error 0
x8009000B "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 err
or. Verify that the correct key is available.
End Error
Error: 2014-10-15 09:47:57.76
   Code: 0xC0016016
   Source:
   Description: Failed to decrypt protected XML node "DTS:Password" with error 0
x8009000B "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 err
or. Verify that the correct key is available.
End Error
Progress: 2014-10-15 09:47:57.88
   Source: Data Flow Task
   Validating: 0% complete
End Progress
Error: 2014-10-15 09:47:57.92
   Code: 0xC0202009
   Source: FranchiseeInfo Connection manager "LDHQSQL.001"
   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 'LD_Transfer001'.".
End Error
Error: 2014-10-15 09:47:57.92
   Code: 0xC020801C
   Source: Data Flow Task OLE DB Source [1]
   Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAG
ER.  The AcquireConnection method call to the connection manager "LDHQSQL.001" f
ailed with error code 0xC0202009.  There may be error messages posted before thi
s with more information on why the AcquireConnection method call failed.
End Error
Error: 2014-10-15 09:47:57.92
   Code: 0xC0047017
   Source: Data Flow Task SSIS.Pipeline
   Description: component "OLE DB Source" (1) failed validation and returned err
or code 0xC020801C.
End Error
Progress: 2014-10-15 09:47:57.93
   Source: Data Flow Task
   Validating: 50% complete
End Progress
Error: 2014-10-15 09:47:57.93
   Code: 0xC004700C
   Source: Data Flow Task SSIS.Pipeline
   Description: One or more component failed validation.
End Error
Error: 2014-10-15 09:47:57.93
   Code: 0xC0024107
   Source: Data Flow Task
   Description: There were errors during task validation.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started:  9:47:57 AM
Finished: 9:47:57 AM
Elapsed:  0.266 seconds

正常运行[通常打开命令提示 没有命令行错误消息

Login succeeded for user 'LD_Transfer001'. Connection made using SQL Server authentication. [CLIENT: <local machine>]

1 个答案:

答案 0 :(得分:1)

敏感信息(即密码)在包中加密。生成的加密密钥来自开发包的机器的用户帐户。

因此,当通过服务运行时,解密密钥不可用,密码无法读取和使用。

有几个选项可供解决:

  1. 在程序包的连接中使用Windows身份验证。

  2. 使用配置文件设置ConnectionString。检查配置文件中的连接字符串是否有明文密码。

  3. 将程序包的 ProtectionLevel 属性设置为 EncryptSensitiveWithPassword EncryptAllWithPassword ,并为DTSExec提供密码。

  4. 方法1是最简单的,但并不总是合适的。

    方法2是一个很好的解决方法,但保留密码为明文。我倾向于选择这种方法,因为我们的DTS包的位置是安全的,我们偶尔需要重新配置东西。我喜欢配置文件!

    方法3也是一个合理的解决方案。请阅读此处以获取更多信息:http://msdn.microsoft.com/en-us/library/ms138023.aspx。 您需要使用/decrypt

    dtsexec选项传递密码