将数据加载到全局临时表中

发布于 2024-10-04 14:32:39 字数 246 浏览 6 评论 0原文

我在同一个 Oracle 用户上有两个不同的 Oracle 会话(“会话 A”和“会话 B”)。

在“会话 A”中,全局临时表填充了大约 320,000 条记录。

如何快速在“会话B”的全局临时表中插入同样的32万条记录?

预先感谢您的好意建议!

编辑:我忘记指定我只能创建全局临时表。

编辑:我忘记指定我不允许创建数据库链接

I have two different Oracle sessions ("session A" and "session B") on the same Oracle user.

A Global Temporary Table is populated, in "session A", with about 320,000 records.

How can I quickly insert the same 320,000 records in the global temporary table of the "session B"?

Thank you in advance for your kind suggestions!

EDIT: I have forgotten to specify that I am allowed to create ONLY GLOBAL TEMPORARY TABLES.

EDIT: I have forgotten to specify that I am not allowed to create database links

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

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

发布评论

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

评论(3

尽揽少女心 2024-10-11 14:32:39

临时表中的数据仅对当前会话可见,因此我认为如果没有其他方法,就没有办法完成您想做的事情。

The data within a temporary table is only ever visible to the current session, so I don't think there's a way to do what you want to do without another approach.

若水般的淡然安静女子 2024-10-11 14:32:39

DBMS_PIPE 是“经典”机制用于将信息从一个会话推送到另一个会话。会话 A 必须将数据推送到管道中,会话 B 必须将数据拉出。

但一般来说,数据库的想法是会话是独立的,任何共性都存在于保存的数据中。与此相反表明您使用了错误的工具。

DBMS_PIPE is the 'classic' mechanism for pushing information from one session to another. Session A would have to push data into the pipe and session B would have to pull it.

But generally the idea of databases is that sessions are independent and any commonality is in the preserved data. Going against this suggests you are using the wrong tool.

谁许谁一生繁华 2024-10-11 14:32:39

全局临时表中的数据仅对插入它的会话可见。因此,您必须运行在会话 B 中填充表的相同进程。

当然,您似乎想要在两个不同的会话中访问相同的 320,000 行,这一事实似乎意味着全局临时表不合适要使用的数据结构。也许您想将该数据加载到永久表中(如果您有多个 SessionA/SessionB 对,可能还需要某种标识符)。或者,会话 B 正在运行的任何逻辑都应该由会话 A 运行。

退一步来说,由于 Oracle 实现了多版本读取一致性,这样读取器不会阻止写入器,写入器也不会阻止读取器,因此首先需要一个 320,000 行的临时表是很不寻常的。

The data in a global temporary table is only visible to the session that inserted it. So you would have to run the same process that populated the table in session B.

Of course, the fact that you appear to want to access the same 320,000 rows in two different sessions would seem to imply that a global temporary table is not the appropriate data structure to be using. Perhaps you want to load that data into a permanent table (possibly along with some sort of identifier if you will have multiple SessionA/ SessionB pairs). Or perhaps whatever logic Session B is running ought to be run by Session A.

And just taking a step back, since Oracle implements multi-version read consistency such that readers don't block writers and writers don't block readers, it would be very unusual to need to have a 320,000 row temporary table in the first place.

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