?
Solved

2 Phase Commit Transaction in SQL Server

Posted on 2014-10-15
2
Medium Priority
?
206 Views
Last Modified: 2014-10-17
What is a 2 phase commit transaction? And is there such a thing in SQL Server?
0
Comment
Question by:metro156
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 1000 total points
ID: 40383260
Two Phase commit is used in distributed data base systems. This is useful to maintain the integrity of the database so that all the users see the same values. It contains DML statements or Remote Procedural calls that reference a remote object. There are basically 2 phases in a 2 phase commit.
1.Prepare Phase :: Global coordinator asks participants to prepare
2.Commit Phase :: Commit all participants to coordinator to Prepared, Read only or abort Reply

Here is an architecture that involves sql server
http://msdn.microsoft.com/en-ca/library/aa754091(v=bts.10).aspx
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 1000 total points
ID: 40383264
2-phase commit is if two (or more, theoretically) databases have had recoverable resources modified during a transaction.  SQL Server absolutely uses 2-phase commit, because there's no real way otherwise to guarantee "all or none" transactions across all resources, which is required by the relational model.  It's most significant with linked servers and other external resources but a version of it is also required if you modify recoverable resources in 2 or more local dbs.

For example, say you are transferring money value from a local db to a remote db.  You never want the money to disappear; likewise, you never want the same money to appear in both locations.  2-phase commit insures that the money is adjusted in both places or neither place, never just one or the other.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question