oracle - 提交dblink?

时间:2012-03-06 10:48:26

标签: sql database oracle commit dblink

如果我以用户smith的身份连接到oracle数据库,并发出以下3个命令:

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

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

commit;

这是否意味着对本地表(smith.tablea)的更新和对远程数据库表(bob.other_table)的插入都已提交或仅提交了对本地表的更新?

注意:'mylink'表示远程数据库的dblink。

2 个答案:

答案 0 :(得分:6)

来自documentation

  

Oracle两阶段提交机制完全透明   发布分布式事务的用户。事实上,用户甚至不需要   知道交易是分发的。一个COMMIT语句表示   事务结束自动触发两阶段提交   提交事务的机制。没有编码或复杂的陈述   需要语法才能在正文中包含分布式事务   数据库应用程序。

所以 - 是的,如果一切顺利,两个操作都会被提交。

答案 1 :(得分:5)

在这种情况下,只有远程交易和本地交易成功时,交易才有效。

有关分布式事务的更多信息:

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