amar on web

Two Phase commit

How does Oracle carry out two Phase commit?

Two Phase Commit is Oracle's method of synchronizing two or more databases so that either everything commits or everything rolls back. One of the controlling parts of this is the "commit_point_strength" in the init.ora file. The DB with the highest "commit_point_strength" becomes the "coordinator" of the process irregardless if the transaction started in that instance. OR, you've started a distributed transaction & issued the "COMMIT" statement, what happens:

  1. The coordinator gets selected. Assuming all of the commit_point_strengths are the same the DB with the most changes is suppose to become the coordinator, don't depend on that though.
  2. The coordinator issuse a "prepare to commit" command otherwise known as "collecting" in DBA_2PC_Pending.
  3. If the remote DB has nothing to commit it replies accordingly & is no longer part of the transaction. This part I know doesn't work consistently. I've opened a TAR on the subject with OTS & they could not explain it either.
  4. DB's that do have changes to make, take out the required locks & do the other things neccessary to commit a change like normal, but hold at the prepared point. They then communicate back to the coordinator that they are ready & promise to do as told.
  5. When the coordinator has recieved the promise from all nodes then the "commit" message is sent and the transaction is complete, for the most part. There is a final message from each node that signifies that they have in deed committed the transaction. If that is received then the issue is assumed to be complete & you get the appriopriate response.
  6. Now, If any of these steps fails, that's when the "pending" transaction stuff shows up in the database and error messages about "remote DB in doubt" start showing up.
**This information is compiled from the web

Best viewed in medium text size. Please refresh this page (F5) to view the latest information.
This page was created on 16-dec-2001 and last updated on 16-dec-2001.
please forward all queries to amar_padhi@fastmail.fm