Dba_2pc_pending Introduction _oracle Application

Source: Internet
Author: User
Tags commit rollback
Dba_2pc_pending
Oracle handles distributed transactions automatically, ensuring the consistency of distributed transactions, and all sites are committed or rolled back. Typically, the process is completed in a very short time and is simply not detectable. However, if a connection outage or a database site crash occurs at the time of a commit or rollback, the commit operation may not continue, and dba_2pc_pending and dba_2pc_neighbors contain the unresolved distribution transactions.



For the vast majority of cases, distributed transactions are automatically resolved when a recovery connection or a crash database is restarted, and no manual intervention is required. A manual operation is used to maintain a distributed transaction only if the object locked by the distributed transaction is in urgent need of access, and the locked rollback segment prevents other transactions from being used, or when a network failure or a crash database recovery takes a long time to occur.


Manual commit or Rollback will lose the two-tier commit feature, Oracle cannot continue to guarantee transactional consistency, and transactional consistency should be guaranteed by manual operators.


For distributed transactions, naming a transaction is a good habit. Also, during the execution of a transaction, you can use alter session ADVISE COMMIT (ROLLBACK), which provides reference information for manually resolving distributed transactions.


When there is a conflict between manually resolving a distributed transaction, such as when one site commits and the other is rollback, the records in dba_2pc_pending are not purged and the dbms_transaction must be used. Purge_mixed process to clear.


If the crash database must be rebuilt, or it cannot be started again, the records in Dba_2pc_pending will not be automatically purged, and dbms_transaction will be used. Purge_lost_db_entry process to clear.


In Oracle9i, when you use both of these procedures, you must be in a undo_management=manual mode where Oracle is not written to the document. General use of the 9i will use Auto mode (Oracle is also recommended), that is, to clear the information in the dba_2pc_pending, you must restart the database two times, feel that the actual use of these two processes is not very useful.



When an unresolved distributed transaction occurs, the tables involved in the distributed transaction may be locked, because Oracle cannot determine which data is committed, which is not committed, and cannot determine the result set that the query operation is visible, so even the query operation cannot be performed on the table.


Using ALTER SYSTEM DISABLE distributed RECOVERY, Oracle can no longer automatically resolve distributed transactions, even if a network recovery connection or a crash database restarts. ALTER SYSTEM ENABLE Distributed recovery Recovery automatically resolves distributed transactions.


To ensure the SCN synchronization between databases, there are two ways to perform a select * from Dual@remote before querying the data or to commit or roll back the current transaction before executing the query.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.