Transactions in SQL Server 2005 Integration Services

  • Jamie Thomson

    SSChampion

    Points: 11805

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/jthomson/transactionsinsqlserver2005integrationservices.asp

  • P Pisarek

    SSC Enthusiast

    Points: 110

    This would also by inference mean that there is no such thing as nested transactions? Or is there another mechanism that could be employed for that?

  • Jamie Thomson

    SSChampion

    Points: 11805

    Good question, and coincidentally one that I was asked yesterday by a colleague upon reading the article.

    You are correct, nested transactions are not supported. This would be an interesting feature request for future versions althought I would fear that this would impact the inherent simplicity of the current behaviour.

    Perhaps this could be handled via a new setting for TransactionOption, 'SupportedNested' or something similar.

    Regards

  • KyawAM

    SSC Journeyman

    Points: 97

    Hi,

    I am having some problem with SSIS transaction. Eventhought I tried to imitate the concept that Jamie presented. My workflow is as followed

    *********************************

    For Each ADO.Record in Oracle (transaction=not supported)

    If (Certain_Field_Value = 'A')

    Lookup Data in SQL DB with values from Oracle (transaction=not supported)

    DO Sequence A (Start a Transaction , transaction=required)

    INSERT/UPDATE some records in SQLDB(transaction=supported)

    Finish Sequence A ( transaction should stop here)

    UPDATE Oracle DB ( Execute SQLTask, transaction=not supported)

    If (Certain_Field_Value = 'B')

    Lookup Data in SQL DB with values from Oracle (transaction=not supported)

    DO Sequence B (Start a Transaction , transaction = required)

    INSERT/UPDATE some records in SQLDB (transaction=supported)

    Finish Sequence A ( transaction should stop here)

    UPDATE Oracle DB ( Execute SQLTask, transaction=not supported)

    If (Certain_Field_Value = 'C')

    ------------

    ------------

    End ForEach Loop

    *************************************

    My requirements are that I want separate transaction for each Sequence A, B, C, etc... If Sequence A transaction fails, the other should still be continuing with another transaction.

    But I am getting an error regarding the OLEDB Error in next Task (e.g in Certain_Field_Value = 'B') "Lookup Data in SQL DB with values from Oracle ", the error message is  ".......Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction. ".

    What is it the I am doing wrong?

    Regards

    KyawAM

  • noeld

    SSC Guru

    Points: 96590

    Nested transactions are complex and "dangerous". There is a raw limit of 32 on the maximum nested level (on both SQL Server 2000 and 2005) which you can hit if you are not careful. Triggers complicate this things further and therefore the logic on the client code gets really convoluted.

    I beleive those reasons should be enough for keeping you from getting into the nested transactions world. I have been there and it is really ugly. Most non trivial applications employ the single transaction model for speed and clarity.

    Good Luck,


    * Noel

  • Jamie Thomson

    SSChampion

    Points: 11805

    Hi there Noel,

    In this case the transactions are handled by DTC. Does the same still aply?

    -Jamie

     

  • omhoge

    SSCertifiable

    Points: 5416

    Jamie, thanks for adding "In this case the transactions are handled by DTC."

    I've been trying to find out what kind of trans. the Sequence Container used.

    We've had issues with DTC in the past.

    If need be, is there a way to use SQL Transactions with the Sequence Container?

    much appreciated! - John

    Skål - jh

  • WFBETC

    Old Hand

    Points: 325

    I am thinking that SSIS DTC does not really work or that there are some special attributes

    that tasks contained in a sequence with transaction=required, that these tasks need to

    have. Is sequentiality and same-thread guaranteed for all tasks in a sequence? I'm getting

    failures on the first task in a transactioned sequence for no reason, am tempted to bag

    SSIS/DTC and go with the literal BEGIN TRANSACTION ( which would involve redesigning

    the whole loop -- arrgghh )

  • omhoge

    SSCertifiable

    Points: 5416

    Since this issue, in other packages I've built,

    I have found that if in the same package,

    there is a truncate task of the same table I am loading

    then DTC will lock up, but SQL transactions will not.

    If that is your situation, you might try putting the truncate in a separate package all together and then use a master controller package to control the flow from truncate to loading packages.

    But I have had DTC hang on that server even without the truncate task and have been tending to avoid it.

    hth

    Skål - jh

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply