Distributed Transactions

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.

Example

--- orcl01 dblink:
create public database link pu_link connect to hr identified by hr using 'orcl02';
 
-- orcl01 execute distributed sql:
update hr.employees set salary=salary+1000 where employee_id=200;
update employees@pu_link set salary=salary+1000 where employee_id=200;
 
-- confirm status
select * from dba_2pc_pending;
 
-- rollback force
rollback force '5.32.251';
 
-- commit force
COMMIT FORCE '5.32.251';
 
-- modify entry
DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('5.32.251');
 
-- dict defination
SQL> desc dba_2pc_neighbors;
 名前                                                                                NULL?    型
 ----------------------------------------------------------------------------------- -------- ---------------------
 LOCAL_TRAN_ID                                                                                VARCHAR2(22)
 IN_OUT                                                                                       VARCHAR2(3)
 DATABASE                                                                                     VARCHAR2(128)
 DBUSER_OWNER                                                                                 VARCHAR2(30)
 INTERFACE                                                                                    VARCHAR2(1)
 DBID                                                                                         VARCHAR2(16)
 SESS#                                                                                        NUMBER(38)
 BRANCH                                                                                       VARCHAR2(128)

Related:
distributed transactions trouble shooting