OLE DB provider "SQLNCLI" for linked server "X" returned message "No transaction is active". Msg 7391, Level 16, State 2, Line 2 The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "X" was unable to begin a distributed transaction.
Before Going to Fix that issue kindly know What is MSDTC? How to Install/Reinstall/know info
about MSDTC?
Solution:
Ref:
http://www.theboreddba.com/Categories/issuesAndBugs/Unable-to-begin-a-Distributed-Transaction.aspx
But if you get again Get error as
Before Going to Fix that issue kindly know What is MSDTC? How to Install/Reinstall/know info
about MSDTC?
I've been talking for a while about MSDTC and transactions without explaining them. I know many of you reading this blog already know the terms, but some of the developers just entering the enterprise space don't know if they should care or not about these subjects.
MSDTC is an acronym for Microsoft Distributed Transaction Coordinator. As the name says, MSDTC is a Windows service providing transaction infrastructure for distributed systems. In this case, a transaction means a general way of structuring the interactions between autonomous agents in a distributed system. Each transaction is a state transformation with four key properties - the ACID properties: Atomic (all or nothing), Consistent (legal), Isolated (independent of concurrent transactions) and Durable (once it happens, it cannot be abrogated). There are different techniques that implement the ACID properties but the most known one is two-phase commit.
In other words, transaction processing is a software technology that makes distributed computing reliable. You can see a transaction as a unit of work in which a series of operations occur. The transaction (with its ACID properties) is providing protection in the case when one or more of these operations fail at any point in time. By using transactions, you can vastly simplify the error recovery for your system.
The main actors in a transaction are: the transaction manager (MSDTC), the initiator (the application which started the transaction) and the resource managers (the entities that manage data and work). The flow of actions in a simplified form is:
1. The client application (the initiator) begins a transaction by requesting one from the transaction manager;
2. The client app asks the resource managers to do work as part of the same transaction; during this step, the resource managers register with the transaction manager for that transaction ("they enlist");
3. The client app commits the transaction;
4. The transaction manager coordinates with the resource managers to ensure that all succeed to do the requested work or none of the work if done, thus maintaining the ACID properties.
The main transactions standard currently supported by MSDTC is the OLE Transactions (or OleTx). MSDTC is also supporting other standards like XA (or X/Open Distributed Transaction Processing Standard) and TIP (Transaction Internet Protocol). In the future MSDTC will support WS-Coordination, WS-AtomicTransaction, and WS-BusinessActivity.
Verify
To perform this procedure, you must have membership in Administrators, or you must have been delegated the appropriate authority.
To verify that the Microsoft Distributed Transaction Coordinator service (MSDTC) is running:
- Click Start, and then click Command Prompt.
- At the command prompt, type sc query msdtc, and then press ENTER.
- The system responds with information about the service. Confirm that these two items appear: SERVICE_NAME: msdtc and STATE : 4 RUNNING.
Reinstall MSDTC on windows 2008
Disaster Recovery for MSDTC on Windows Server 2003 and 2008
Solution:
Ref:
http://www.theboreddba.com/Categories/issuesAndBugs/Unable-to-begin-a-Distributed-Transaction.aspx
Unable to begin a Distributed Transaction
This occured on a client's machine after they had migrated their SQL Server to new hardware with a fresh install of Windows Server 2008 R2. They attempted to use a linked server and received the following error message:
The first thing to do here is to check the DTC (Distributed Transaction Coordinator) settings on your Windows server:
In Windows, click on START -> Admin Tools -> Component Services
This will open the following window:
Expand the left hand tree through Component Services, Computers, and My Computer. Then click on Distributed Transaction Coordinator.
You will then see an icon in the middle panel of the window which says "Local DTC":
Right click Local DTC and select Properties. You will then get a Properties Form. On this form, select the Security tab:
If “Network Access DTC” and all the other check boxes are not ticked as per the above, then tick them and press Okay.
You should get a warning box stating that Windows needs to restart the MSDTC service. Click yes (as this takes less than a second).
Once restarted, go back and check your original SQL query. It should now run successfully.
Open Event Viewer by clicking START -> Admin Tools -> Event Viewer:
Under Windows Logs -> Application you should be able to see an Error with teh MSDTC client:
Basically as you can see from the error, this was caused by cloning the machine and therefore causing a duplicate MSDTC on the network.
Luckily this is very easy to fix. Simply open a command prompt with Administrator Rights and type:
Press Enter. Once completed, type:
Press Enter again. Go to Services and Start the MSDTC service:
And that should fix your problem. Try your SQL query again and see what happens.
OLE DB provider "SQLNCLI" for linked server "X" returned message "No transaction is active".
Msg 7391, Level 16, State 2, Line 2
The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "X" was unable to begin a distributed transaction.
The first thing to do here is to check the DTC (Distributed Transaction Coordinator) settings on your Windows server:
In Windows, click on START -> Admin Tools -> Component Services
You will then see an icon in the middle panel of the window which says "Local DTC":
You should get a warning box stating that Windows needs to restart the MSDTC service. Click yes (as this takes less than a second).
Once restarted, go back and check your original SQL query. It should now run successfully.
Caveat for a cloned machine
If you have created your server by using a clone of another machine and the above steps did not fix the issue (or maybe the Network Access DTC boxes were already ticked), then you could be looking at another problem entirely...Open Event Viewer by clicking START -> Admin Tools -> Event Viewer:
Luckily this is very easy to fix. Simply open a command prompt with Administrator Rights and type:
msdtc -uninstall
Press Enter. Once completed, type:
msdtc -install
Press Enter again. Go to Services and Start the MSDTC service:
But if you get again Get error as
No comments:
Post a Comment