Solved

2 Phase Commit Transaction in SQL Server

Posted on 2014-10-15
2
156 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
2 Comments
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 250 total points
Comment Utility
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:
ScottPletcher earned 250 total points
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now