oracle 中 commit 是如何工作的

发布于 2024-12-29 17:28:09 字数 447 浏览 1 评论 0原文

我有几个语句,伪代码看起来像这样:

insert into local_table
crease savepoint sp1

insert into remote_db //using db_link
update local_table2
delete from local_table
commit

现在我对 insert into remote_db 语句有点困惑。正在应用的提交是否有可能对 local_dbremote_db 产生不同的影响?

问题陈述有点复杂。将数据从 local_db 复制到 remote_db 的脚本正在生成重复项。经过调查后,这是唯一看起来可疑的地方,但我不确定。如果有人能够阐明 Oracle 的 COMMIT ,我将非常感激

I have couple of statements, the pseudo code would look something like this:

insert into local_table
crease savepoint sp1

insert into remote_db //using db_link
update local_table2
delete from local_table
commit

Now I'm kinda confused as to the insert into remote_db statement. Would there be any chance that the commit which is being applied has different affect on local_db and on remote_db?

The problem statement is kind of complex. The script which copies data from local_db to remote_db is producing duplicates. After performing an investigation, that's the only place which looks suspicious but I am not sure. Would really appreciate if someone can shed light on Oracle's COMMIT

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过期以后 2025-01-05 17:28:09

如果您询问提交是否可能导致重复行,不,这是不可能的。

鉴于分布式事务发生的方式,该事务有可能根本不会在远程数据库上提交(在这种情况下,它将是远程 DBA 可能需要解决的不确定分布式事务)。但如果事务提交成功,则它将被正确提交。某些行将被提交而其他行则不会,或者提交行为不可能创建在提交之前不存在的重复行。

If you are asking whether the commit could potentially cause duplicate rows, no, that's not possible.

Given the way that distributed transactions take place, it is possible that that transaction would not be committed at all on the remote database (in which case it would be an in-doubt distributed transaction that the remote DBA would likely need to resolve). But if the transaction is committed successfully, it's going to be committed correctly. It's not possible that some rows would get committed and others wouldn't or that duplicate rows that didn't exist prior to the commit would be created by the act of committing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文