Link to home
Start Free TrialLog in
Avatar of sikyala
sikyalaFlag for United States of America

asked on

How do I resolve issue with materialized view refresh execution

I created 3 materialized views that are not complex and do not have any depencies. I created log tables on all of the views. However, when I execute the refresh command on 2 of the mv I get the following error:

ERROR at line 1:
ORA-12004: REFRESH FAST cannot be used for materialized view
"TEMS_ADM_ORIG"."SINGLE_PAGES_MVIEW"
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2251
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2457
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2426
ORA-06512: at line 1

There is no errors when I create the mv and their associated log table. I have been trying to refresh the views as the owner of the views.


Here are the materialized views I can't seem to refresh:
 
CREATE MATERIALIZED VIEW MULTI_PAGES_MVIEW 
REFRESH ON DEMAND
AS 
select Decode(SITE,'CBIAC', 'CBRNIAC', 'CPIA', 'CPIAC', site)||'-' ||PDF_NAME as ACCESSION_NUMBER, Decode(SITE,'CBIAC', 'CBRNIAC', 'CPIA', 'CPIAC', site) as site, pdf_name, pdf_page_file_path, DB_INSERTED, DB_UPDATED from multi_pages where site in ('AMMTIAC','CBIAC','CPIA', 'DACS','HSIAC','IATAC', 'RIAC','SENSIAC','SURVIAC','WSTIAC');
 
CREATE INDEX MULTI_PAGES_MVIEW_INDX ON MULTI_PAGES_MVIEW (ACCESSION_NUMBER);
 
CREATE MATERIALIZED VIEW SINGLE_PAGES_MVIEW 
REFRESH ON DEMAND
AS
 select Decode(SITE,'CBIAC', 'CBRNIAC', 'CPIA', 'CPIAC', site)||'-' ||PDF_NAME as ACCESSION_NUMBER, Decode(SITE,'CBIAC', 'CBRNIAC', 'CPIA', 'CPIAC', site) as site, pdf_name, pdf_page_file_path, pdf_page_num from single_pages  where site in ('AMMTIAC','CBIAC','CPIA', 'DACS','HSIAC','IATAC', 'RIAC', 'SENSIAC', 'SURVIAC', 'WSTIAC');

Open in new window

Avatar of HainKurt
HainKurt
Flag of Canada image

what command are you using to refresh them?
ASKER CERTIFIED SOLUTION
Avatar of Muhammad Noman Iqbal
Muhammad Noman Iqbal
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sikyala

ASKER

execute DBMS_MVIEW.REFRESH('tems_adm_orig.MULTI_PAGES_MVIEW' ,'F');
execute DBMS_MVIEW.REFRESH('tems_adm_orig.SINGLE_PAGES_MVIEW' ,'F');
Avatar of Helena Marková
ORA-12004: REFRESH FAST cannot be used for materialized view "string"."string"
    Cause: The materialized view log does not exist or cannot be used. PCT refresh is also not enabled on the materialized view
    Action: Use just REFRESH, which will reinstantiate the entire table. If a materialized view log exists and the form of the materialized view allows the use of a materialized view log or PCT refresh is possible after a given set of changes, REFRESH FAST will be available starting the next time the materialized view is refreshed.

It seems that there are no MV LOGs in your definition.
Avatar of sikyala

ASKER

The ID field is the primary key in the master table and I did not have it in the list of fields for the materialized views. When I created the materialized view log I have the with primary key clause. So not having the PK in the mv caused the error. It allowed me to create the mv but it wouldn't allow me to refresh it.