【发布时间】:2014-10-11 17:11:00
【问题描述】:
我想在提交时创建物化 oracle 视图,指向同一数据库实例中不同模式的表。
模式(BATCH):
CREATE TABLE "BATCH"."BATCH_CONFIG"
( "KEY" VARCHAR2(100 BYTE),
"VALUE" VARCHAR2(4000 BYTE),
"COMMENTS" VARCHAR2(4000 BYTE),
"UPDATED_BY" VARCHAR2(25 BYTE),
"UPDATED" TIMESTAMP (6),
CONSTRAINT "PK_BATCH_CONFIG" PRIMARY KEY ("KEY")
);
create materialized view log on batch_config;
grant all on batch_config to profile;
架构(配置文件):
create materialized view mv_batch_config REFRESH FAST ON COMMIT
as select * from BATCH.batch_config;
出错了:
SQL Error: ORA-12018: following error encountered during code generation for "PROFILE"."MV_BATCH_CONFIG"
ORA-00942: table or view does not exist
12018. 0000 - "following error encountered during code generation for \"%s\".\"%s\""
*Cause: The refresh operations for the indicated materialized view could
not be regenerated due to errors.
*Action: Correct the problem indicated in the following error messages and
repeat the operation.
有什么问题?我可以通过(从配置文件模式)select * from BATCH.batch_config 来查看查询
【问题讨论】:
-
你的 batch.batch_config 表上有主键吗?
-
是的。 CREATE TABLE "BATCH"."BATCH_CONFIG" ("KEY" VARCHAR2(100 BYTE), "VALUE" VARCHAR2(4000 BYTE), "COMMENTS" VARCHAR2(4000 BYTE), "UPDATED_BY" VARCHAR2(25 BYTE), "UPDATED" TIMESTAMP (6)、CONSTRAINT "PK_BATCH_CONFIG" PRIMARY KEY("KEY"))