5 Replies Latest reply: Jun 9, 2011 4:13 PM by user3514542 RSS

    Unable to begin a distributed transaction

    user3514542
      Hi All,

      I was referred to this forum from a post in the general forum, apologies for the duplication. (Re: Unable to begin a distributed transaction

      I have been struggling now for a couple of days with an issue and I am at the end of my tether, can anyone help me with the following issue:

      Environment:

      This is all being run locally on my laptop with Windows 7 Professional SP1
      Oracle 11g (11.1.0.6.0) Enterprise Edition
      SQL Server 2008

      Problem:

      I am trying to transfer data to my SQL database from an Oracle database using a linked server (OraOLEDB.Oracle Provider) using a stored procedure within my application and I get the message:

      The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "SERVERNAME" was unable to begin a distributed transaction.

      Resolutions tried so far:

      -I am able to connect to the Oracle database using SQLPLUS and by testing the Linked Server connection
      -I can query the Oracle database using a select statement from SQL by referencing the Linked Server
      -The SQL Query that is running from my application runs fine if I run it directly from a query within SQL
      -MSDTC Service is running (as are my Oracle services)
      -Windows Firewall is disabled and I have allowed MSDTC access through it anyway
      -I have enabled all the checkboxes under Security in the MSDTC component services to Enable DTC Access, Allow Remote Clients, Allow Remote Admin, Allow Inbound, Allow Outbound, No Authentication, Enable XA Transactions, Enable SNA LU 6.2 Transactions and the DTC Logon account is the NT AUTHORITY\NETWORK SERVICE
      -I have checked the registry to ensure the HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\MSDTC\MTxOCI lib dll values are for Oracle 11 (oci.dll, orasql11.dll & oraclient11.dll)
      -I have enabled the 'Allow InProcess' under the OraOLEDB.Oracle Provider in SQL Server Objects
      -I have tried using the Microsoft Oracle driver just in case but this gives a similar message
      -The SQL Query runs an insert into the SQL database by selecting data from an OPENQUERY transaction data set, as previously stated, if I run this statement outside of the distributed transaction on its own, it works. This query also works in another environment so im positive my issue is environment related and not query related.
      -I have installed the Oracle Windows Interfaces component of the Oracle 11g application

      The sad part of this whole situation is that I previously had this running fine on the same machine but I formatted and reinstalled the OS so this is now occurring in a clean install.

      I cannot think of anything else to add to all of that, so any assistance would be greatly appreciated.

      Regards

      Chris
        • 1. Re: Unable to begin a distributed transaction
          gdarling - oracle
          Is this intermittent or consistently reproducible?

          When you say "MSDTC Service is running (as are my Oracle services)", is OracleMTSRecoveryService one of them? My WAG is that you don't have the Oracle Service for Microsoft Transaction Server installed on your cleint. If you check Services, do you see "OracleMTSRecoveryService"? If not, rerun the client install, choose Custom, make sure to select your existing home, and add it.

          Note that the recovery service isnt needed to actually participate in distrib transactions (it's only used for recovery) , but it gets installed at the same time as the other pieces, so if you're missing the recovery service, you're also missing the other pieces.

          Hope it helps,
          Greg
          • 2. Re: Unable to begin a distributed transaction
            user3514542
            Hi Greg,

            Thanks for the response.

            The problem is reproduce able every time.

            That service is there and I did install the Oracle Service for Microsoft Transaction Server specifically from the custom components (although I was not aware it creates that service, so I have learnt something new)
            • 3. Re: Unable to begin a distributed transaction
              Klibby-Oracle
              What else is going on within your stored procedure? Most of the time people do not write a stored procedure when a query is sufficient.
              • 4. Re: Unable to begin a distributed transaction
                gdarling - oracle
                Ok, looking a little closer at your previous data points:

                1) Using Microsoft's OLEDB also fails, and Microsoft's and Oracle's OLEDB providers use very different mechanisms when it comes to distributed transactions. That doesnt solve the problem for us, but is interesting.

                2) 11.1.0.6 is not supported on Win7. 11.1.anthing is not, for that matter. 10205, 11201, and 11202 are the supported versions.
                That being said though, you might want to try patching up to 11107 client. you might be runing into this bug, fixed in 11107
                Using ORAMTS on Microsoft Vista Results in The Error ORA-161 (Doc ID 467181.1)
                The better solution though is to use a supported config, and you'll already have the fix.

                3) The next step is probably to get sqlnet traces and see if there's a better error message.


                SQLNET Tracing:
                =============
                If you are unsure how to obtain a trace, place the following entries in the client Sqlnet.ORA file (should be in %Oracle_home%\network\admin). Make sure before you start your application that the C:\Trace directory exists.

                TRACE_FILE_CLIENT = nettrace
                TRACE_DIRECTORY_CLIENT = C:\trace
                TRACE_UNIQUE_CLIENT = OFF
                TRACE_LEVEL_CLIENT = 16
                TRACE_TIMESTAMP_CLIENT = ON
                DIAG_ADR_ENABLED=OFF

                Save Sqlnet.ora, and restart the application if needed as the tracing parameters only get picked up when the connection is first established. Reproduce the problem behavior. Back in Sqlnet.ora, set TRACE_LEVEL_CLIENT = OFF to turn off tracing, and save Sqlnet.ora. Stop or restart the app again so tracing does not continue.

                4) If you have a support contract, open a SR. However, you'll probably want to get into a supported configuration before doing that.

                Greg
                • 5. Re: Unable to begin a distributed transaction
                  user3514542
                  One thing I forgot is the stored procedure calls a sql query which extracts the data from Oracle to transfer to SQL but at the end it sends an update back to Oracle so perhaps that is where the issue comes from.

                  Im still convinced this is an environment issue as I had this exact same system working prior to my reinstall and the queries/stored procedure have not changed.

                  I am going to be out of the office for a couple of days but I will try the software updates and see if that helps when I get back, I may have done this previously and just forgotten that I did (anything is possible!)

                  Thanks for the assistance, I will post an update after I have tried it to see if it worked or not.