简体   繁体   English

SSIS序列容器交易选项

[英]SSIS Sequence container Transaction Option

I have an SSIS package which is pretty simple, just a data import and an execute SQL task thereafter. 我有一个非常简单的SSIS程序包,只是一个数据导入和此后的执行SQL任务。 I want to roll everything back if any part of the package should fail so I put these tasks within a Sequence Container and set the Sequence Container TransactionOption property to 'Required' and set FailPackageonFailure property to 'True'. 如果程序包的任何部分失败,我想回滚所有内容,因此我将这些任务放入序列容器中,并将序列容器TransactionOption属性设置为“ Required”,并将FailPackageonFailure属性设置为“ True”。 This worked fine when I was targeting the local db. 当我定位到本地数据库时,此方法运行良好。 However when I try to change the OLE DB Connection to a remote server the aforementioned property settings cause the package to hang and finally fail with a message of 'Could Not Acquire Connection'. 但是,当我尝试将OLE DB连接更改为远程服务器时,上述属性设置导致程序包挂起并最终失败,并显示消息“无法获取连接”。 I have seen similar descriptions of this problem on the web but the advise is always to check the Connection. 我在网上看到过类似的问题描述,但建议始终检查连接。 However I know the connection is fine because when I change TransactionOption property back to its default of 'Supported' the package runs fine. 但是我知道连接很好,因为当我将TransactionOption属性更改回其默认值“ Supported”时,程序包运行良好。

Does anyone know why this could occur? 有谁知道为什么会这样? I'm assuming it has something to do with different settings on the server I'm trying to connect to. 我假设它与我要连接的服务器上的不同设置有关。 Also does anyone know a different way of ensuring a complete rollback if any part of the package should fail. 如果软件包的任何部分出现故障,是否有人知道确保完全回滚的另一种方法。

Thanks for reading 谢谢阅读

You need to use the Distributed Transaction Coordinator. 您需要使用分布式事务处理协调器。

The Distributed Transaction Coordinator (DTC) service coordinates transactions that update two or more transaction-protected resources, such as databases, message queues, files systems, and so on. These transaction-protected resources may be on a single computer or distributed across many networked computers.

Because you are trying to establish transactions between servers, it requires a service to coordinate the SQL Server Services. 因为您正在尝试在服务器之间建立事务,所以它需要一项服务来协调SQL Server服务。 Here is an article on how to do it. 是有关如何执行操作的文章。

Make sure to start and configure the service, as well as create exceptions in the windows firewall for the services between the servers. 确保启动和配置服务,并在Windows防火墙中为服务器之间的服务创建例外。

See this article on Transactions for more information: http://www.mssqltips.com/tip.asp?tip=1585 有关更多信息,请参见本文上的事务: http : //www.mssqltips.com/tip.asp?tip=1585

Also you might need to look more into how the MSDTC works in relation to SSIS to get your issue resolved. 另外,您可能需要更多地研究MSDTC与SSIS相关的工作方式,以解决问题。

Another option: 另外一个选项:

Leverage the RetainSameConnection property of the OLE DB Connection and you can run regular SQL Server transactions in SSIS over multiple tasks without requiring the use of Distributed Transaction Coordinator (DTC). 利用OLE DB连接的RetainSameConnection属性,您可以在多个任务中在SSIS中运行常规SQL Server事务,而无需使用分布式事务处理协调器(DTC)。 In this article Jamie Thomson shows us how. 杰米·汤姆森(Jamie Thomson) 在本文中向我们展示了方法。

The implication is that you can BEGIN TRANSACTION in one Execute SQL Task and then choose to COMMIT or ROLLBACK in another one. 这意味着您可以在一个执行SQL任务中开始事务,然后在另一项中选择COMMIT或ROLLBACK。

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

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