Oracle 的物化视图

发布于 2024-08-09 17:36:06 字数 544 浏览 6 评论 0原文

我的脚本中有以下行,但我不明白“using”部分的用途。
我在谷歌上找不到任何东西。有人熟悉吗?
多谢 !!

CREATE MATERIALIZED VIEW "PVTRNDM"."DM_MVW_DAILY_CAL" 
 USING ("DM_MVW_DAILY_CAL", 
        (8, 'PLANVP.XXXX.INT', 1, 0, 0, "PVTRN", "DAILY_CAL", '2009-10-15 16:12:25', 8, 45073, '2009-10-15 16:12:25', '', 1, '0E', 6548400, 0, NULL), 
        2101313, 8, ('1950-01-01 12:00:00', 111, 0, 0, 6548400, 0, 2054, 2, NULL, NULL)) 
 REFRESH FORCE AS 
 select day_date, cal , sum(NVL(daily_du, 0)) AS daily_du FROM PVPROD.daily_cal GROUP BY day_date, cal ;

I have the following line in a script and I don't understand what the "using" part is used for.
I couldn't find anything on google. Anybody familiar with that ?
Thanks a lot !!

CREATE MATERIALIZED VIEW "PVTRNDM"."DM_MVW_DAILY_CAL" 
 USING ("DM_MVW_DAILY_CAL", 
        (8, 'PLANVP.XXXX.INT', 1, 0, 0, "PVTRN", "DAILY_CAL", '2009-10-15 16:12:25', 8, 45073, '2009-10-15 16:12:25', '', 1, '0E', 6548400, 0, NULL), 
        2101313, 8, ('1950-01-01 12:00:00', 111, 0, 0, 6548400, 0, 2054, 2, NULL, NULL)) 
 REFRESH FORCE AS 
 select day_date, cal , sum(NVL(daily_du, 0)) AS daily_du FROM PVPROD.daily_cal GROUP BY day_date, cal ;

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

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

发布评论

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

评论(5

帅气称霸 2024-08-16 17:36:06

嗯,这很有趣。我将代码插入到蟾蜍中并做了一些更改:

创建物化视图 mv_jfhtesting
使用 ("mv_jfhtesting",("hi","by"))
刷新力选择“这个”,“那个”
来自双

这导致:ORA-12037 - 未知的导出格式
当我查到的时候是:

原因:尝试导入
由导出的物化视图
未知的导出版本(例如,来自
比导入站点更新的版本)

操作:使用
已知的导出版本
导入站点。

所以,我的猜测是这个子句从另一个MV导入数据。
(或者甚至它本身,也许?)
抱歉我没有时间再玩这个了

Well, this was interesting. I took the code and plugged it into toad and made a few changes:

CREATE MATERIALIZED VIEW mv_jfhtesting
USING ("mv_jfhtesting",("hi","by"))
REFRESH FORCE AS select "this","that"
from dual

This resulted in: ORA-12037 - Unknown Export Format
Which, when I looked it up was:

Cause: An attempt was made to import a
materialized view exported by an
unknown export version (e.g., from a
newer release than the importing site)

Action: Re-export the file using a
version of export known by the
importing site.

So, my guess is that this clause imports data from another MV.
(or even itself, maybe?)
Sorry I don't have time to play with this more

感情旳空白 2024-08-16 17:36:06

奇怪的。您在数据库中是否有该对象,如果有,DBMS_METADATA.GET_DDL 会为您提供什么。
如果不存在该格式的 SQL,我怀疑有人已导出架构并将 SQL 从 DUMP 文件中复制出来。

Odd. Do you have the object in a database, and if so, what does DBMS_METADATA.GET_DDL give you for it.
If that format of the SQL isn't there, I suspect someone has done an export of the schema and copied the SQL out of the DUMP file.

尸血腥色 2024-08-16 17:36:06

我想我已经弄清楚了(或者至少有一个建议)。
我从具有 REFRESH ON DEMAND 物化视图的用户中进行了导出,然后尝试将其导入到具有 CREATE TABLE 但没有 CREATE MATERIALIZED VIEW 权限的用户中。

它创建了一个同名的表,但在物化视图上出错了。
我的猜测是,在进行导出时,它将MV中的数据导出为表。 CREATE MATERIALIZED VIEW 的这种奇怪语法将该表转换为 MV。我猜这些日期与源数据库上上次刷新 MV 的时间有关(如果存在可应用于下一次刷新的 MV 日志,这可能是相关的)。

I think I've figured it out (or at least have a suggestion).
I did an export from a user that had a REFRESH ON DEMAND materialized view, then I tried importing that into a user that had CREATE TABLE, but not CREATE MATERIALIZED VIEW privileges.

It created a table of that name, but errored out on the materialized view.
My guess is that when doing an export, it exports the data in the MV as a table. This odd syntax for CREATE MATERIALIZED VIEW turns that table into an MV. I'd guess the dates are to do with when the MV was last refreshed on the source database (which may be relevant if there MV logs that can be applied for the next refresh).

遮了一弯 2024-08-16 17:36:06

USING 是某种 JOIN。

使用“USING”进行连接

the USING is somekind of JOIN.

Use "USING" for Joins

橙幽之幻 2024-08-16 17:36:06

他们是使用索引 条款

Their is a USING INDEX clause

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