Oracle 的物化视图
我的脚本中有以下行,但我不明白“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
嗯,这很有趣。我将代码插入到蟾蜍中并做了一些更改:
这导致:ORA-12037 - 未知的导出格式
当我查到的时候是:
所以,我的猜测是这个子句从另一个MV导入数据。
(或者甚至它本身,也许?)
抱歉我没有时间再玩这个了
Well, this was interesting. I took the code and plugged it into toad and made a few changes:
This resulted in: ORA-12037 - Unknown Export Format
Which, when I looked it up was:
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
奇怪的。您在数据库中是否有该对象,如果有,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.
我想我已经弄清楚了(或者至少有一个建议)。
我从具有 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).
USING 是某种 JOIN。
使用“USING”进行连接
the USING is somekind of JOIN.
Use "USING" for Joins
他们是使用索引 条款
Their is a USING INDEX clause