IsolationLevel = Snapshot, TransactionOption = Required

  • For love nor money, we can't get this to work. I'm trying this oh so simple example on a dev box with SQL Server 2005 Developer Ed. SP2 , Windows XP SP2.

    The Source Database:

    Use master

    ALTER DATABASE MyDB

    SET ALLOW_SNAPSHOT_ISOLATION ON

    GO

    The Package:

    1) Create a package, any name will do.

    2) Create a new OLE DB connection with default settings to a database on local SQL Server 2005 SP2 Dev Ed. which you are a SysAdmin of.

    3) Add an "Execute SQL Task" to the Control Flow. (I only chose this to keep it simple but any component will do). Edit the SQL Task to "select count(*) from SomeTable". This won't do anything particularly useful but should just connect to the database, count the rows in the table and return a success.

    4) Right click the SQL Task component and select properties.

    5) In the properties pane, set the IsolationLevel property to "Snapshot"

    6) Set the TransactionOption property to "Required".

    7) Execute the package.

    Every time this fails with:

    [Execute SQL Task] Error: Failed to acquire connection "(local).MyDB". Connection may not be configured correctly or you may not have the right permissions on this connection.

    [Connection manager "(local).MyDB"] Error: The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D00A "Unable to enlist in the transaction.".

    [Connection manager "(local).MyDB"] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x8004D00A.

    Please note: MSDTC is running and security configuration has been configured as:

    Network DTS Access = 1

    Allow Remote Clients = 1

    Allow Remote Administration = 1

    Allow Inbound = 1

    Allow Outbound = 1

    Mutual Authentication Required = 1

    Enable Transaction Internet Protocol (TIP) Transactions = 1

    Enable XA Transaction = 1

    Account: NTAUTHORITY\NETWORK SERVICE

    SSIS service is running under NTAUTHORITY\NETWORK SERVICE.

    I'm a sysadmin, even tried making ntauthorityetwork service a sysadmin. Nothing. Fail fail fail. If I change the IsolationLevel to anything else this runs fine. I've been here http://support.microsoft.com/kb/914375 but I'm running SP2!

    Have I completely missed something here? :blink:

  • Let's see if it is really the snapshot isolation level, or just your DTC configuration.

    Create a second ExecuteSQL task in the package and set the package to require transaction as well as the secons ExecuteSQL task (to ensure they are both added to the same transaction by DTC).

    Do not turn on the snapshot isolation and see if you get the DTC error. With a single component, DTC does not really need to create a distribute transaction, so you may only be seeing an error because it has to start one to support the snapshot isolation.

    If you get a DTC error with a second component in your transaction and snapshot isolation off, your DTC configuration is incorrect (it is pretty touchy to set up, so this is likely).

  • Hi Michael, thanks for the quick response!

    As you suggested, I have added a second Execute SQL Task configured in exactly the same way as the first one described previously except, also as requested:

    IsolationLevel = ReadCommited

    Transaction Option = Required

    The package ran OK (both components start, turn yellow and run at the same time, go green, no errors). Looks like MSDTC is set up ok.

    I change the settings on both components back to:

    IsolationLevel = Snapshot

    Transaction Option = Required

    And it fails.

    I tried both these article but the problem persists:

    http://support.microsoft.com/kb/839279/en-us

    http://support.microsoft.com/kb/329332/en-us

  • Is anyone else able to reproduce this?

    Has anyone else been able to force a required snapshot transaction with SSIS?

    Cheers,

    Martin

  • *sigh* I'm losing the plot here. :crying:

    Snapshot isolation cannot be used within distributed queries.

    http://msdn2.microsoft.com/en-us/library/ms188277.aspx

    "For most applications, read committed isolation using row versioning is recommended over snapshot isolation for the following reasons:

    * It consumes less tempdb space than snapshot isolation.

    * It works with distributed transactions, whereas snapshot isolation does not.

    * It works with most existing applications without requiring any change. Applications written using the default isolation level, read committed, can be dynamically tuned. The behavior of read committed, whether to use row versioning or not, is determined by the database option setting, and this can be changed without affecting the application."

    Seeing as how what we want is to run a SSIS package within a single snapshot transaction and SSIS uses the MSDTC to manage transactions but snapshot isolation is not supported in distributed queries... does that logic flow?

    If something does not support distributed queries does that mean it does not support distributed transactions?

  • Hmmm... I thought that the read-committed row-versioning (as opposed to JUST row versioning without the read-committed option) would allow distributed transactions and distributed queries.

    But maybe it was just the former, and not the latter.

    From the posts I have seen, you need to turn on the read-committed before changing the isolation level to row versioning.

Viewing 6 posts - 1 through 5 (of 5 total)

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