Database data integrity with a two-phase mechanism

Asked By 0 points N/A Posted on -
qa-featured

I need experts to please tell me how a two-phase commit mechanism in distributed databases ensures there is data integrity. I am working on an assignment related to database data integrity and this issue seems to be hard. I just need a few pointers on this.

 

SHARE
Best Answer by Dexter Alberto
Answered By 0 points N/A #96865

Database data integrity with a two-phase mechanism

qa-featured

In distributed system the database ensure the integrity of the data by using the two-phase commit mechanism.

Prepare phase:

During this phase the initiating node in the transaction ask the other participating nodes to promise roll back or to commit  the transactions.

Commit phase: 

During this phase the initiating node asks all participating nodes to commit the transaction, and if this outcome is not possible, then all nodes are asked to roll back and hence integrity ensures.

This is how the two phases in Distributed system ensures integrity. for further instruction go to oracle or microsoft sql official website.

 

 

Best Answer
Best Answer
Answered By 0 points N/A #96867

Database data integrity with a two-phase mechanism

qa-featured

Hello FeloM,

A two-phase commit mechanism is a technique used in database to ensure there is data integrity in distributed transactions and ensures there is concurrency control. The phases in this mechanism are:

  • Prepare phase – The node which initiates the transaction, also called the global coordinator, initiates the transaction and requests all participating nodes, excluding the commit point site, to commit to the transaction or roll back the transaction, even in case of a failure. If any node cannot get ready to commit, the whole transaction is rolled back.
  • Commit phase – In this phase, if all the participating nodes are prepared, they respond to the coordinator which in this case, the commit point site is requested to commit. After committing to the transaction, all other nodes are requested to also commit to the transaction. When all nodes have committed to the transaction, there is consistency in the database.
  • Forget phase – In this phase, all the participating nodes have committed and the coordinator informs the commit point that all nodes have committed. The commit point deletes its information about the transaction and informs the coordinator about this deletion and the coordinator deletes its own information about the transaction (forgets about the transaction).

These are the phases which ensures there is data integrity and consistency in a database using the two-phase commit mechanism.

Thank you.

Related Questions