Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

delete data from base_table and then refresh mv failed!

AndySkySep 28 2010 — edited Sep 28 2010
SQL> Create Table tb_test03(Id Number,Name Varchar2(1024));

Table created.

SQL> CREATE MATERIALIZED VIEW LOG ON tb_test03 WITH SEQUENCE, ROWID
2 (Id)INCLUDING NEW VALUES;

Materialized view log created.

SQL> CREATE MATERIALIZED VIEW mv_tb_test03
2 PCTFREE 0 TABLESPACE Users
3 STORAGE (INITIAL 8M)
4 BUILD IMMEDIATE
5 REFRESH Fast On Commit
6 ENABLE QUERY REWRITE
7 AS SELECT Id,Count(1) From tb_test03 Group By Id;

Materialized view created.

SQL> Insert Into tb_test03 Values(123,'test');

1 row created.

SQL> commit;

Commit complete.

SQL> Declare
2 Begin
3 DBMS_MVIEW.REFRESH('MV_TB_TEST03');
4 End;
5 /

PL/SQL procedure successfully completed.

SQL> Delete From tb_test03 Where Id=123;

1 row deleted.

SQL> commit;

Commit complete.

SQL> Declare
2 Begin
3 DBMS_MVIEW.REFRESH('MV_TB_TEST03');
4 End;
5 /
Declare
*
ERROR at line 1:
ORA-12057: materialized view "HXL"."MV_TB_TEST03" is INVALID and must complete
refresh
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2558
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2771
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2740
ORA-06512: at line 3

Hi,I deleted a record from a table and then refresh materialized views,get a error messgae(show above),why?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2010
Added on Sep 28 2010
11 comments
3,889 views