简体   繁体   English

在服务器之间复制文件时出现 SSIS 文件系统任务错误

[英]SSIS File System Task Error while copying files between servers

I can copy files between two servers say Server A and Server B manually and I have permissions to folders on either side.我可以在两台服务器之间复制文件,比如手动服务器 A 和服务器 B,我对任一侧的文件夹都有权限。

I am using File System Task to Copy files.我正在使用文件系统任务来复制文件。

When my Source and Destination are within the Server the Package works fine in visual studio as well as SSISDB.当我的源和目标在服务器中时,包在 Visual Studio 和 SSISDB 中工作正常。

When my Source and Destination are in different Servers the Package works fine in visual studio but package fails in SSISDB.当我的源和目标位于不同的服务器中时,包在 Visual Studio 中工作正常,但包在 SSISDB 中失败。 It is saying access is denied.它说访问被拒绝。 My Account is mapped to SSISDB.我的帐户映射到 SSISDB。

Any idea to solve this issue.解决这个问题的任何想法。

The package runs fine using the the SQL Server Agent JoB.该包使用 SQL Server 代理作业运行良好。 The job is run through the proxy account.该作业通过代理帐户运行。

Any way we can configure Package to Run through proxy account.我们可以通过任何方式将包配置为通过代理帐户运行。

Error Screenshot错误截图

在此处输入图片说明

First of all @Nick.McDermaid provided a very helpful link in the comments to learn more on Which user credentials does Integration Services Catalog use to execute packages?首先@Nick.McDermaid 在评论中提供了一个非常有用的链接,以了解有关Integration Services Catalog 使用哪些用户凭据来执行包的更多信息?

Suggested Solutions建议的解决方案

After searching there are many issues that may causes this problem, so i will provide many solutions that can solve your problem.经过搜索有很多问题可能会导致此问题,因此我将提供许多可以解决您问题的解决方案。

When Running package SSISDB运行包 SSISDB 时

1. SQL Server Accounts Permissions 1. SQL Server 账户权限

Add Read & Write permissions to the The account you are logged in on the specified paths在指定路径上为您登录的帐户添加读写权限

2. Add a windows authentication to the Network account 2.为Network账号添加windows身份验证

You can add a Windows authentication login for the network account (used as proxy in sql server agent) and run the package using it.您可以为网络帐户添加 Windows 身份验证登录(在 sql server 代理中用作代理)并使用它运行包。

When Running package from SQL Agent从 SQL 代理运行包时

This is not your case, but these infos may helps这不是您的情况,但这些信息可能会有所帮助

1. SQL Server Accounts Permissions 1. SQL Server 账户权限

Add Read & Write permissions to the following accounts on the specified paths:为指定路径上的以下帐户添加读写权限:

  • NT SERVICE\\SQLSERVERAGENT
  • NT SERVICE\\MSSQLSERVER

2. Setting up a Proxy 2. 设置代理

You can setup a proxy for the SSIS package and run the job using that proxy account.您可以为 SSIS 包设置代理并使用该代理帐户运行作业。

You can refer to one of the following links to learn more:您可以参考以下链接之一以了解更多信息:

3. Map Network Drives to SQL Server instance 3. 将网络驱动器映射到 SQL Server 实例

Some articles suggests to map the network drives you are using on SQL Server (not the OS).You can refer to one of the following links to learn more:一些文章建议映射您在 SQL Server(而不是操作系统)上使用的网络驱动器。您可以参考以下链接之一以了解更多信息:

4. Adding SysAdmin Role 4. 添加系统管理员角色

Add SysAdmin Role to the following accounts:将 SysAdmin 角色添加到以下帐户:

  • NT SERVICE\\SQLSERVERAGENT
  • NT SERVICE\\MSSQLSERVER

Other Links having Similar issue其他链接有类似问题

Have you looked at permissions on MSDB for your domain account.您是否查看过域帐户对 MSDB 的权限。 I would follow these steps.我会遵循这些步骤。 I have had similar issue我有类似的问题

1) deploy the package in server ( as you have already done) 1)在服务器中部署包(正如您已经完成的那样)

2) Ensure packages are Loaded and Available in Integration Services Catalogs Under SSISDB 2) 确保包已加载并在 SSISDB 下的集成服务目录中可用

3) Redeploy the project and try it. 3)重新部署项目并尝试。

If these all fine, still package failing in SSISDB, i would try windows scheduler task with CMD (DTEXUI/ File/'Package Path').如果这些都很好,仍然在 SSISDB 中打包失败,我会尝试使用 CMD(DTEXUI/文件/“包路径”)的 Windows 调度程序任务。 Apologies if it isnt relevant talking about windows scheduler.如果谈论 Windows 调度程序无关紧要,请道歉。

I ran onto a similar issue some time ago : I had to copy files from a server to the one executing SSIS before loading them.前段时间我遇到了类似的问题:在加载文件之前,我必须将文件从服务器复制到执行 SSIS 的服务器。

If the package was configured to use only local directories, it worked every time.如果包被配置为只使用本地目录,它每次都能工作。 If I launched it manually, it worked with different machines.如果我手动启动它,它可以在不同的机器上工作。 But when it came to SQL Agent + different machines, it failed.但是当涉及到 SQL Agent + 不同机器时,它失败了。

I figured it was a problem with local and AD accounts by crawling through SQL logs and a bit of scripting in Visual Studio.通过在 Visual Studio 中抓取 SQL 日志和一些脚本,我认为这是本地和 AD 帐户的问题。

I solved this issue by :我通过以下方式解决了这个问题:

  1. creating a non interactive user account that I granted enough on the SSIS machine (more or less sysadmin on SQL Server, a very few folder access on server... fit to your needs)创建一个非交互式用户帐户,我在 SSIS 机器上授予了足够的权限(SQL Server 上的系统管理员或多或少,服务器上的文件夹访问权限很少......适合您的需要)
  2. granting this account to have access to the other server's folder (through ACL)授予此帐户访问其他服务器文件夹的权限(通过 ACL)
  3. updating my SQL Agent service to use this "legal" AD account更新我的 SQL 代理服务以使用这个“合法”的 AD 帐户
  4. done !完毕 !

This has been working every day since almost a year without a single problem.近一年以来,这每天都在工作,没有任何问题。

There are a lot of guesses and red herrings in the answers and comments posted.发布的答案和评论中有很多猜测和红鲱鱼。 It has nothing to do with SQL Agent proxies, mapped drives, MSDB or sysadmin.它与 SQL 代理代理、映射驱动器、MSDB 或系统管理员无关。 As eventually gleaned from your question, the execution in SQL Agent is fine, it's just when you run it interactively by right clicking in the Integration Services catalog that the issue occurs.正如最终从您的问题中收集到的那样,SQL Agent 中的执行很好,只是当您通过右键单击 Integration Services 目录以交互方式运行它时才会出现问题。

The final part of your question indicates the root cause is understood here:您问题的最后一部分表明根本原因在这里被理解:

Any way we can configure Package to Run through proxy account.我们可以通过任何方式将包配置为通过代理帐户运行。

The interactive user (the one right clicking on the catalog) doesn't have rights and you need a way to run from the catalog as a different user that does have rights.交互式用户(在目录上单击鼠标右键)没有权限,您需要一种方法来作为具有权限的不同用户从目录中运行。

Just for confirmation: if you click View Context in your SSIS log it will show you which user it ran as, which will be different to the successful package executions from SQL Agent.只是为了确认:如果您在 SSIS 日志中单击查看上下文,它将向您显示它以哪个用户身份运行,这与 SQL 代理的成功包执行不同。

I dug around the execution and configuration menus in the catalog as well as the create_execution sp, and I don't see any way to run it as a different user.我仔细研究了目录中的执行和配置菜单以及create_execution sp,我没有看到任何以不同用户身份运行它的方法。

I have two suggestions:我有两个建议:

  1. Use Run As when starting SSMS and run as a different user启动 SSMS 时使用运行身份并以其他用户身份运行
  2. Just wrap the package up in a SQL Agent, which allows you to use other accounts to run the package (either the SQL Agent service account or a proxy)只需将包包装在 SQL 代理中,它允许您使用其他帐户来运行包(SQL 代理服务帐户或代理)

I got a similar error.我遇到了类似的错误。 Trying to move the file from one folder to another using File System task and got the following error message and尝试使用文件系统任务将文件从一个文件夹移动到另一个文件夹并收到以下错误消息和

Solution: Create Connection manager to point to the Source file location and Create a variable named "DesVariable" to show the destination file path(eg) C:\\abc.解决方案:创建连接管理器以指向源文件位置并创建一个名为“DesVariable”的变量以显示目标文件路径(例如)C:\\abc。 In the File system, Task properties set the following在文件系统中,任务属性设置如下

IsSourcePathVariable: False SourceConnection : SourceFileConnectionManager IsSourcePathVariable: False SourceConnection : SourceFileConnectionManager

IsDestinationPathVariable: True DestinationVariable: DesVariable IsDestinationPathVariable: True DestinationVariable: DesVariable

Then it went through然后就通过了

[Move/Copy file-file system task properties] [移动/复制文件-文件系统任务属性]

FileSystemTask properties文件系统任务属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM