我正在尝试在我的应用程序中调整物化视图.我开始执行:
dbms_advisor.tune_mview()
过程,并将以下代码写入Oracle SQL Developer的SQL_Worksheet:
variable mvtask varchar2(100); variable mvddl varchar2(4000); execute :mvtask := 'MV_FOO_BAR'; execute select query into :mvddl from user_mviews where view_name = 'MV_FOO_BAR'; execute dbms_advisor.tune_mview(:mvtask, :mvddl); select * from user_tune_mview;
显然,已经创建了物化视图(refresh fast on commmit
然而,其运行速度令人无法接受地慢).顾问报告以下错误:
Error report: ORA-13600: error encountered in Advisor QSM-03112: Invalid CREATE MATERIALIZED VIEW statement ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86 ORA-06512: at "SYS.PRVT_ACCESS_ADVISOR", line 202 ORA-06512: at "SYS.PRVT_TUNE_MVIEW", line 1026 ORA-06512: at "SYS.DBMS_ADVISOR", line 754 ORA-06512: at line 1 13600. 00000 - "error encountered in Advisor\n%s" *Cause: An error occurred in the Advisor. This message will be followed by a second message giving more details about the nature of the error. *Action: See the Advisor documentation for an explanation of the second error message.
但是,没有更多的报道,没有第二个错误消息的痕迹.有谁知道这里的问题是什么?我已经更加惊讶,因为MV已经存在并在数据库中工作,尽管速度很慢.
在相关的说明中,有没有人知道如何在SQL Developer中输入多行字符串.当我尝试这样的事情:
execute :mvddl :='create materialized view MV_FOO_BAR build immediate refresh fast on commit ... ';
SQL Developer在第一行窒息.字符串连接在我脑海中浮现,但我有几个100到150行的MV,我讨厌为它们中的每一行手动完成.
(1)当错误13600的文本引用"第二错误消息"时,它表示堆栈中的下一个错误 - 在这种情况下为QSM-03112.
(2)我认为错误的原因是,对TUNE_MVIEW的调用中的第二个参数是CREATE MATERIALIZED VIEW语句的全文,但是您只传递查询文本.
(3)对于多行问题,如果你使用显式的PL/SQL匿名块而不是"执行",我希望它能工作,例如:
BEGIN :mvddl := 'create materialized view MV_FOO_BAR build immediate refresh fast on commit ... '; END; /