Distributed Transactions and Linked Servers
I'm somewhat of a novice with SQL Server but I'm learning rapidly from an application I'm developing that uses SQL Server very heavily. In conjunction with the development of this application, I have 3-4 systems set up running SQL Server and I am using those
systems to develop the database that will ultimately support the application. I decided to try to use linked servers because I am moving data back-and-forth among the different servers frequently and I ran into some consequences that I wasn't expecting.
I was doing a simple delete query on one of the servers (Delete from TableName Where ...) and I was expecting, of course, that it would only impact the server I was running it on; however, when the query finished after running for a long time, it was apparent
that SQL Server had automatically escalated that simple delete query into a distributed transaction and applied it to all four of the linked servers I had defined. I was totally surprised by that and it took some time to recover the data that was inadvertently
lost on the other servers.
I want to ensure that this doesn't happen again without me expecting it - I think the right way to prevent this from happening is to run the following stored procedure:
EXEC sp_serveroption 'servername', 'remote proc transaction promotion', 'false';
Can someone please verify that this assumption is correct and will prevent SQL Server from automatically creating distributed transactions impacting multiple servers?
Thanks,
Chuck
Hello,
Based on your description, it seems that when you connect to a SQL Server database and execute a DELETE statement to delete a recode on a table, and then the same recode were delete in the linked server which has the same table.
As pre my understand, the statement executed on one server will not apply to the linked servers unless you specify the logic yourself in the application. For example, you use dynamic query and exec the query synchronously on linked servers.
What's more, did you specify replication between this linked server?
If I have any misunderstanding, please let me know.
Regards,
Fanny Liu
If you have any feedback on our support, please click here.
Fanny Liu
TechNet Community Support
Similar Messages
-
Distributed transactions and 2-phase commit in a SAP Netweaver environment
Hello,
I am a Java architect., I don't know very much the SAP technologies. I tried to found on forums or technical papers if SAP does support distributed transactions and two-phase commit, it's not clear. I found something on SAP WAS but my project is using a SAP PI 7.0 and I cannot find anything on the subject.
My goal is to include a SAP server (via PI 7.0) in a distributed transaction handled by a J2EE ESB (Oracle, ex-BEA Aqualogic) based on XA capabilities.
Does anyone have experience or feedback on this topic ?
Thanks.Hi,
Do you know this white paper ?
[Distributed Transaction and 2 phase commit|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3732d690-0201-0010-a993-b92aab79701f]
Regards,
Olivier -
Weblogic 5.1, Distributed Transaction and Oracle Database Link
We are planning to add a new functionality to run in Weblogic server and it
needs to update tables in two different Oracle databases. Since we are using
Weblogic 5.1 and it is unrealistic to upgrade to 6.1 in short term, we have
to deal with the fact that distributed transaction is not supported by JTS
on 5.1.
One workaround we can think of is to utilize Oracle database link. Instead
of having two connection pools, the application talks to only one database
and access the tables on the other ones through Oracle database link.
Therefore, when a session bean tries to update two tables on database 1 in
one transaction, one of the tables is just a link to the other database. We
hope that even though distributed transaction is not supported by JTS in
Weblogic 5.1, but since it is supported by Orable, it would work.
Do you think the above workaround would work? Does anyone have experience on
something like that?
Thanks in advance,
David Chen
[email protected]Hi. You should be able to use any JDBC driver with WebLogic 5.1.
It may be the JVM that complains, if you use too old a JVM...
Joe Weinstein at BEA Systems -
Distributed transaction using linked server not working in SQL Server 2008 64 bit
Hi. I have had an issue trying to get distributed transactions to work in SQL Server 2008 using a linked server. The error message I get is
OLE DB provider "SQLNCLI10" for linked server "pod1" returned message "No transaction is active.".
Msg 7391, Level 16, State 2, Line 3
The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "pod1" was unable to begin a distributed transaction.
My Environment:
Windows Server 2008 Enterprise 64 bit, SQL Server 2008 Enterprise 64 bit
Problem occurs with multiple different builds of SQL Server 2008 - I have been able to reproduce the problem with 10.0.1600.0, 10.0.1779.0 (CU 2), as well as 10.0.2531 (SP1)
I am aware that other people have had this issue and have reviewed all existing posts. I have verified that the MSDTC is configured correctly on both machines. I have also used DTCTester to verify that DTC is working correctly on all machines in question.
None of the mentioned resolutions has solved this problem for me.
I am not seeing this problem occur on my 32 bit test machines - it is only occurring if at least one of the two machines is 64 bit.Hi All,
I realise that this topic may be a little bit out-of-date but if someone gets here from some search engine trying to find a solution for DTC problems, this MAY be useful.
So... I recently had the same issue, tried all the approaches described in KB and other articles, but it didn't help. Because my task to solve this was not of the highest priority I forgot about it for some time.
Today I was troubleshooting some other issue and, by accident discovered source of that first problem:
In the EventViewer I found Error entry logged by MSDTC saying:
"The local MS DTC detected that the MS DTC on vm-server1 (other machine name that also runs DTC - my comment) has the same unique identity as the local MS DTC. This means that the two MS DTC will not be able to communicate
with each other. This problem typically occurs if one of the systems were cloned using unsupported cloning tools. MS DTC requires that the systems be cloned using supported cloning tools such as SYSPREP. Running 'msdtc -uninstall' and then 'msdtc -install'
from the command prompt will fix the problem. Note: Running 'msdtc -uninstall' will result in the system losing all MS DTC configuration information."
So I followed suggestion and run:
msdtc -uninstall
msdtc -install
This solved my problems with DTC. Hope it will help someone.
Piotr -
Need basic primer on distributed transactions and java
Hello,
I am new to distributed transactions in Java...
I am wondering if there is useful link that will
explain the basics....
How is it supported in J2EE, etc.?
How is it supported in WLS?
How does 2-phase commit work, etc.?
Thanks,
Jason
Hi,
I fond the following a good clear, concise (non vendor specific) intro to
transactions.
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Transaction.html
Cheers,
SB
"Jason Rosenberg" <[email protected]> wrote in message
news:3eba8128$[email protected]..
> Hello,
>
> I am new to distributed transactions in Java...
>
> I am wondering if there is useful link that will
> explain the basics....
>
> How is it supported in J2EE, etc.?
> How is it supported in WLS?
> How does 2-phase commit work, etc.?
>
> Thanks,
>
> Jason
>
>
-
Distributed transactions and connection pooling
Hi,
We have a problem with the enlistment of connections in distributed transactions.
The following very simple C# program does not work correctly (a simple form with one button and a class hosted in COM+). If you put a breakpoint on "cnOraTx.Close();" you will see that the inserted record is already visible in the database although the transaction has not commited yet.
If you comment out the lines between //START and //END everything works as expected.
Also, if we use "Pooling=false" in the connection string, everything works fine again, but since we are writing a web application, we really need the connection pooling.
We are using ODP.NET 9.2.0.2.102 (I also tried with the ODP.NET 9.2.0.4.0 BETA) and an oracle 8.1.7 database.
Best Regards,
Piet
private void button1_Click(object sender, System.EventArgs e)
//When commenting the following lines the connection is enlisted in the distributed transaction
//START
OracleConnection cnOraTx;
cnOraTx = new Oracle.DataAccess.Client.OracleConnection("Data Source=ECOMP532;User ID=USER;Password=PWD");
cnOraTx.Open();
cnOraTx.Close();
cnOraTx.Dispose();
//END
OpenOraTransConn obj = new OpenOraTransConn();
obj.Connect();
//This class is going to be hosted within COM+
[Transaction(TransactionOption.Required)]
public class OpenOraTransConn: ServicedComponent
private OracleConnection cnOraTx;
private OracleCommand cmd;
internal void Connect()
cnOraTx = new OracleConnection("Data Source=ECOMP532;User ID=USER;Password=PWD");
cnOraTx.Open();
cmd = new OracleCommand();
cmd.Connection = cnOraTx;
cmd.CommandText = "INSERT INTO SYSADM.PERSON (PE_KEY) VALUES(130000)";
cmd.ExecuteNonQuery();
cnOraTx.Close();
cnOraTx.Dispose();
ContextUtil.SetComplete();Hello:
We are experiencing the exact same problem. INSERT, UPDATE or DELETE statements that should roll back because an exception is being thrown from inside our ServicedComponent-derived class (which is set to TransactionOption.Required and uses AutoComplete) are not -- and instead are being committed to the database.
Were you able to figure out why this is happening, and what can be done to get around it? We too were able to avoid the problem by setting Pooling=False to our connect string, but for a variety of reasons we want to use connection pooling ...! -
MDB Distributed transaction and stored procedure rollback
Hi All,
I am developing an asynchronous application using MDB. My application flow is as follows:
1. From MDB onMessage i am calling another method MEthodA that
a. calls a simple pojo1 where I am getting a Connection on XA enable datasource1 and executing Stored Procedure1 of DatabaseSchema1. In Stored Procedure1 I have some inner savpoints and rollback. No commit is inside Stored Procedure1 .
b. In that pojo withput commiting m closing the connection and coming back in MethodA.
c. Again from MethodA m calling an different pojo2 where I am getting a new Connection on XA enable datasource2 and executing Stored Procedure2 of DatabaseSchema1.In this pojo also without commiting m closing the connection and coming back in MethodA. In Stored Procedure2 I have some inner savpoints and rollback. No commit is inside Stored Procedure2 .
d. Again from MethodA m calling pojo1 where I am getting a new Connection on XA enable datasource1 and executing a diffrent function of Stored Procedure1 of DatabaseSchema1.
Now problem is:
I have written some Savepoint and rollback inside Stored Procedure1 and inside Stored Procedure2. But these rollback is working only in inside Stored Procedure1 not in inside Stored Procedure2 in each case.
In ejb-jar.xml transaction attributes is Required for all methods and transaction type is Container.
Backend is Oracle 10g and init.xa has already been run on that.
I have tested this on Oc4J and Websphere 6.0.
I am using XaDatasource.
Will be very obliged if any one can give a single hint of the problem as soon as possible.
Thanks a lotHi Kent;
You have a few choices (AFAIK) with ASE...
1) AutoCommit = TRUE
- must be before connect to your DB
2) End your PB transaction first. For example
String ls_end = "END TRANSACTION"
String ls_begin = "BEGIN TRANSACTION"
EXECUTE IMMEDIATE ls_end using SQLCA;
<call your SP>
EXECUTE IMMEDIATE ls_begin using SQLCA;
3) use a 2nd Transaction Object for the SP where its AutoCommit = TRUE
- or -
4) In your SP ...
Commit Transaction
begin transaction
insert into mytab (pub_id) values ("9999")
commit transaction -
Errors in DB alert log for distributed transactions
Hi,
I am receiving the following type of errors regularly in one of our development databases:
Errors in file e:\oracle\product\diag\rdbms\agdev10g\agdev10g\trace\agdev10g_reco_16356.trc:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
ORA-02062: distributed recovery received DBID d672931d, expected 2d7b9dec
ORA-12154: TNS:could not resolve the connect identifier specified
ORA-12500: TNS:listener failed to start a dedicated server process
ORA-12154: TNS:could not resolve the connect identifier specified
From researching on the net it looks like it may have something to do with distributed transactions and database links however I'm not sure how to proceed to diagnose the problem and find out where the issue is. Can anyone help?
Thanks
Adam
Edited by: Adam J. Sawyer on 27/05/2010 16:57SQL*Net typically involves two systems so post following details for both systems
Post Operating System (OS) name & version for DB server system.
Post results of
SELECT * from v$version
or post Oracle version to 4 decimal places
oerr ora 12514
12514, 00000, "TNS:listener does not currently know of service requested in connect descriptor"
// *Cause: The listener received a request to establish a connection to a
// database or other service. The connect descriptor received by the listener
// specified a service name for a service (usually a database service)
// that either has not yet dynamically registered with the listener or has
// not been statically configured for the listener. This may be a temporary
// condition such as after the listener has started, but before the database
// instance has registered with the listener.
// *Action:
// - Wait a moment and try to connect a second time.
// - Check which services are currently known by the listener by executing:
// lsnrctl services <listener name>
// - Check that the SERVICE_NAME parameter in the connect descriptor of the
// net service name used specifies a service known by the listener.
// - If an easy connect naming connect identifier was used, check that
// the service name specified is a service known by the listener.
// - Check for an event in the listener.log file.
bcm@bcm-laptop:~$ oerr ora 2062
02062, 00000, "distributed recovery received DBID %s, expected %s"
// *Cause: a database link at a coordinator no longer points to the expected
// database. Link may have been redefined, or a different DB mounted.
// *Action: restore link definition or remote database.
bcm@bcm-laptop:~$ oerr ora 12154
12154, 00000, "TNS:could not resolve the connect identifier specified"
// *Cause: A connection to a database or other service was requested using
// a connect identifier, and the connect identifier specified could not
// be resolved into a connect descriptor using one of the naming methods
// configured. For example, if the type of connect identifier used was a
// net service name then the net service name could not be found in a
// naming method repository, or the repository could not be
// located or reached.
// *Action:
// - If you are using local naming (TNSNAMES.ORA file):
// - Make sure that "TNSNAMES" is listed as one of the values of the
// NAMES.DIRECTORY_PATH parameter in the Oracle Net profile
// (SQLNET.ORA)
// - Verify that a TNSNAMES.ORA file exists and is in the proper
// directory and is accessible.
// - Check that the net service name used as the connect identifier
// exists in the TNSNAMES.ORA file.
// - Make sure there are no syntax errors anywhere in the TNSNAMES.ORA
// file. Look for unmatched parentheses or stray characters. Errors
// in a TNSNAMES.ORA file may make it unusable.
// - If you are using directory naming:
// - Verify that "LDAP" is listed as one of the values of the
// NAMES.DIRETORY_PATH parameter in the Oracle Net profile
// (SQLNET.ORA).
// - Verify that the LDAP directory server is up and that it is
// accessible.
// - Verify that the net service name or database name used as the
// connect identifier is configured in the directory.
// - Verify that the default context being used is correct by
// specifying a fully qualified net service name or a full LDAP DN
// as the connect identifier
// - If you are using easy connect naming:
// - Verify that "EZCONNECT" is listed as one of the values of the
// NAMES.DIRETORY_PATH parameter in the Oracle Net profile
// (SQLNET.ORA).
// - Make sure the host, port and service name specified
// are correct.
// - Try enclosing the connect identifier in quote marks.
// See the Oracle Net Services Administrators Guide or the Oracle
// operating system specific guide for more information on naming.
bcm@bcm-laptop:~$ oerr ora 12500
12500, 00000, "TNS:listener failed to start a dedicated server process"
// *Cause: The process of starting up a dedicated server process failed.
// The executable could not be found or the environment may be set up
// incorrectly.
// *Action: Turn on tracing at the ADMIN level and reexecute the operation.
// Verify that the ORACLE Server executable is present and has execute
// permissions enabled. Ensure that the ORACLE environment is specified
// correctly in LISTENER.ORA. The Oracle Protocol Adapter that is being
// called may not be installed on the local hard drive. Please check that
// the correct Protocol Adapter are successfully linked.
// If error persists, contact Oracle Customer Support.What explicit SQL or command trigger these errors? -
Distributed Transaction in weblogic 5.1
Hi all,
Does Weblogic 5.1 support Distributed Transactions?.While they aren't java-specific, if you're looking for XA/2PC details,
these 2 are good:
Transaction Processing: Concepts and Techniques (Morgan Kaufmann Series
in Data Management Systems)
by Jim Gray, Andreas Reuter
Principles of Transaction Processing
by Philip A. Bernstein, Eric Newcomer (Contributor)
5.1 does not support XA or 2 phase-commit. However, it does allow
multiple cluster members to enlist in the same transaction as long as
all database access goes through the same JDBC connection.
WLS 6.0 and later do support XA and 2PC.
-- Rob
chandrasekar wrote:
Hi all,
Does Weblogic 5.1 support Distributed Transactions?.Please suggest me some
books or documentation regarding Distributed Transactions, and about the XA compliant
resources. -
Distributed transactions, distributed objects
An observation and a conjecture about distributed transactions
and distributed object references:
Distributed non-service object references are persistent, and
a transaction can, in principle, propagate to the distributed
object through a method call from another partition.
However, in order to make the transaction propagate to the
object's partition the object must also have the
isTransactional attribute set to TRUE. The Forté runtime
system apparently uses the isTransactional property not only
for rollback of a distributed object's state, but also to
indicate whether it is desired that transactions propagate to
the object's partition. Thus, the behavior of a distributed
object reference with respect to distributed transactions can
be controlled by the value of the isTransactional attribute
in the same way that the behavior of an environment-visible
service object with respect to distributed transactions can
be controlled by the dialog duration.
Comments?
John Hodgson |Descartes Systems Group Inc.|Tel TBD
Systems Engineer|120 Randall Drive |Fax TBD
|Waterloo, Ontario |www.descartes.com
|CANADA N2V 1C6 |[email protected]
Get Your Private, Free Email at http://www.hotmail.com
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>http://transxtrail.sourceforge.net/
-
Cannot change transaction isolation during distributed transaction
Hi All,
When ever the IPortalComponent session expires my application is throwing Null pointer exception. So I am catching the NullPointer exception and then reloading the page again. It is working in frontend without any issues.
But in the error log monitor(nwa) I can see the below error when reloading the page after component session expires.
Cannot change transaction isolation during distributed transaction and when the connection is shared. DataSource name: "PRODB2
As per my knowledge I understood that this is happening beacuse application is trying to recreate a new connection pool while one pool instance is alive.
If this is correct can any one tell me how to destory the pool of current session when reloading the page.
Thanks in Advance,
Chinna.What was the solution to the problem ?
-
Hi all,
If any one has worked around this error and can help ?
Msg 8522, Level 16, State 3, Line 1
Microsoft Distributed Transaction Coordinator (MS DTC) has stopped this transaction.
I am trying to connect from sql 2012 to 2000 server. Established linked server using native client 10. I am able to see catalogs and database and table. Just when I am trying to query i am getting above error.
any help is really appreciated.
Thanks
Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to TeachHi Logicinisde,
What the new error message do you get after using the workarounds in this
blog? Please post it for analysis.
Besides, as SQL Server 2012 has stopped connecting to SQL Server 2000 via linked servers, personally I recommend you upgrade SQL Server 2000 to a higher version to make your queries or ETLs efficient.
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support -
How to data insert Source server and Linked server (Target Server) at same transaction
I have try several times for Data insert Source server and Linked server (Target Server) at same transaction. I am using Begin transaction. but Source server is completed and Linked server error (or Linked server Completed and source server
ERROR). at this moment I want ROLL back. how?Hi
Run below query by changing to yourr linked server name and see if DTC is enable or not.. if not
Begin distributed transaction
select * from [ServerName].master.dbo.sysprocesses
Commit Transaction
To enable MSDTC on each Web server on Windows Server 2008
Click Start, click Run, type dcomcnfg and then click OK to open Component Services.
In the console tree, expand Component Services, expand Computers, expand My Computer, and then expand Distributed Transaction Coordinator.
Right click Local DTC, and click Properties to display the Local DTC Properties dialog box.
Click the Security tab.
In the Security Settings section, click Network DTC Access.
In the Client and Administration section, select Allow Remote Clients and Allow Remote Administration.
In the Transaction Manager Communication section, select Allow Inbound and Allow Outbound.
In the Transaction Manager Communication section, select Mutual Authentication Required (if all remote machines are running Windows Server 2003 SP1), select Incoming Caller Authentication Required (if running MSDTC in a cluster), or select No Authentication
Required if some of the remote machines are pre-Windows Server 2003 SP1. No Authentication Required is the recommended selection.
Select Enable XA Transactions, and then click OK.
Repeat steps 1 through 9 on the other Web servers.
Thanks
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers -
ORA-00164 Autonomous and Distributed Transactions in Oracle 8i - Forms6i
Hi, in Forms6i I'm using Autonomous transactions (insert and update), and I want to use also a database link to make a query in a remote database (Distributed transaction). Even when this request are done in different PL/SQL within Forms6i, I get the error message ORA-00164 Distributed transactions disallowed within autonomous transactions. Is there a way to avoid this error message?
ThanxHello,
I had a similar Problem, when I tried to log errormessages while selecting by db-link.
I use pipes now to send the errormessages. The pipe is read at regular intervals and then I can Insert without using autonomous transactions.
I hope, this will help you
Marcus -
All I want to know is if Distributed Transaction Coordinator services of the application role are required by SQL Server 2012 for clustering and support of SharePoint 2013.
I have been planning and deploying my companies first Windows Server 2012/SQL Server 2012 Always On cluster and Always On Availability Groups Multi-Subnet cluster and instances for SharePoint 2013, and I will be brutally honest, the documentation on either
the MSDN and TechNet leave alot to be desired. Continually finding links in the documentation will take me from a Windows 2012 reference to a page talking about Windows Server 2008 or R2, The differences of which there are so many when it comes to configurations,
settings, roles, services when working with SQL Server 2012. I have been confused, frustrated, screaming mad, with all the misdirection in this documentation. The documentation takes me windows 2008 R2 which is different than 2012!
Tired and trying to pick myself up off the floor!
Greg
GmanIn general, DTC is not required for SQL 2012. But, since you are asking specifically about SharePoint, it would be better to ask in a SharePoint forum. They would be more likely to know those situations where FTC might be needed by SharePoint.
.:|:.:|:. tim
Maybe you are looking for
-
Unable to login using OAM Custom Authentication Plugin
Hi, I have a problem with OAM Custom Authentication Plugin, My Plugin is Activate successfully. When try to login from Access Manager SSO login page, it is unable to login. I am getting followiing message in the log file. I am return ExecutionStatus.
-
I downloaded ICS earlier this week on to my Droid 4. The "Select Keyboard" notification kept popping up and it was annoying me, so I looked around on line to see if there was a way to make it stop. Someone suggested disabling the "Motorola Input" a
-
Which folder shall I put, when I import Jar file in the Apache?
Hi, I m meeting a problem: I need to import javax package in the jsp page, and I copy the relevant Jar file into WEB-INFO/lib folder, but it doesn't work: i execute the page in the IE explorer that is showed "import javax package is not found". I don
-
Adobe security advisory: http://www.adobe.com/support/security/advisories/apsa10-01.html "A critical vulnerability exists in Adobe Flash Player 10.0.45.2 and earlier versions for Windows, Macintosh, Linux and Solaris operating systems..." Is the Flas
-
Replacement for Adobe Photoshop 3.0 Home Edition
I hope I am in the right forum but I have a very OLD 1996 Edition for photoshop that does now work well with XP. I tried to replace it many years ago with elements 2.0 but found the learning curve was well beyond my capabilities. I have heard that th