简体   繁体   中英

SSIS Sequence container Transaction Option

I have an SSIS package which is pretty simple, just a data import and an execute SQL task thereafter. 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'. 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'. 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.

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. 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.

See this article on Transactions for more information: 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.

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). In this article Jamie Thomson shows us how.

The implication is that you can BEGIN TRANSACTION in one Execute SQL Task and then choose to COMMIT or ROLLBACK in another one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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