oracle - commit over dblink?

南楼画角 提交于 2020-12-08 06:04:58

问题


If I connect to an oracle database as user smith, and issue the following 3 commands:

update smith.tablea
set col_name = 'florence' where col_id = 8;

insert into bob.other_table@mylink
values ('blah',2,'uncle','new');

commit;

Does this mean that the update to the local table (smith.tablea) and the insert to the remote db table (bob.other_table) have both been committed or that just the update to the local table has been committed?

Note: that 'mylink' represents a dblink to a remote database.


回答1:


In this case the transaction should only work if the remote transaction and your local transaction are successfull.

More information about distributed transactions:

http://docs.oracle.com/cd/B19306_01/server.102/b14231/ds_txnman.htm




回答2:


From documentation

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.

so - yes, if everything goes fine, both operations are commited.



来源:https://stackoverflow.com/questions/9582125/oracle-commit-over-dblink

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!