The Two-Phase Commit Mechanism (149)

tsinglee發表於2007-11-06

In a distributed database, Oracle must coordinate transaction control over a
network and maintain data consistency, even if a network or system failure
occurs.

A distributed transaction is a transaction that includes one or more statements
that update data on two or more distinct nodes of a distributed database.

A two-phase commit mechanism guarantees that all database servers participating
in a distributed transaction either all commit or all undo the statements in the
transaction. A two-phase commit mechanism also protects implicit DML operations
performed by integrity constraints, remote procedure calls, and triggers.

The Oracle two-phase commit mechanism is completely transparent to users who
issue distributed transactions. In fact, users need not even know the
transaction is distributed. A COMMIT statement denoting the end of a transaction automatically
triggers the two-phase commit mechanism to commit the transaction. No coding or
complex statement syntax is required to include distributed transactions within
the body of a database application.

The recoverer (RECO) background process automatically resolves the outcome of
in-doubt distributed transactions—distributed transactions in which the commit
was interrupted by any type of system or network failure. After the failure is
repaired and communication is reestablished, the RECO process of each local Oracle database
automatically commits or rolls back any in-doubt distributed transactions
consistently on all involved nodes.

In the event of a long-term failure, Oracle allows each local administrator to
manually commit or undo any distributed transactions that are in doubt as a result of the
failure. This option enables the local database administrator to free any locked
resources that are held indefinitely as a result of the long-term failure.

If a database must be recovered to a point in the past, Oracle’s recovery
facilities enable database administrators at other sites to return their databases to the
earlier point in time also. This operation ensures that the global database remains
consistent.

兩層提交機制
1. 分散式事務指同一個事務中的一個或多個 SQL 語句同時更新分佈在分散式資料庫中不同節點的資料.
2. 兩層提交機制可以保證所有參與分散式事務的資料庫或者同時提交 ,或者同時撤銷事務中SQL語句的操作.
兩步提交機制還確保了由完整性約束 ,遠端過程呼叫 ,及觸發器執行的隱式 DML 操作正常工作.
3. 拿不準的分散式事務指因為各種系統或網路故障而阻礙了提交操作的分散式事務.

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-980941/,如需轉載,請註明出處,否則將追究法律責任。

相關文章