Solved

2 Phase Commit Transaction in SQL Server

Posted on 2014-10-15
2
195 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 250 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 250 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

726 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