[Materialized View] - NEEDS_COMPILE Problem ... no refresh

Hello,
I've a strange problem with an Oracle 8.1.7.4 DB.
I've a table 'BRANCARD'
I create a MV with auto-refresh.
<code>
CREATE MATERIALIZED VIEW MV_00087_BRANCARD
STORAGE (INITIAL 100K NEXT 100K PCTINCREASE 0)
TABLESPACE BRANCA
REFRESH FAST
WITH PRIMARY KEY
START WITH SYSDATE NEXT SYSDATE+1/1440
DISABLE QUERY REWRITE AS
select * from brancard where no_hop='00087' order by no_branc,ty_branc;
Materialized view created.</code>
my problem :
At the first refresh...
<code>
select MVIEW_NAME, UPDATABLE, REWRITE_ENABLED, REWRITE_CAPABILITY, REFRESH_MODE, REFRESH_METHOD, STALENESS, AFTER_FAST_REFRESH, COMPILE_STATE from all_mviews
MVIEW_NAME U R REWRITE_C REFRES REFRESH_ STALENESS AFTER_FAS COMPILE_STATE
MV_00087_BRANCARD Y N TEXTMATCH DEMAND FAST FRESH FRESH NEEDS_COMPILE
VUE_00087_ETA N N GENERAL DEMAND COMPLETE UNDEFINED UNDEFINED VALID
VUE_00087_PASSINT N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
VUE_00087_PDT N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
VUE_00087_PLTTECH N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
VUE_00087_SER N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
VUE_00087_UAD N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
VUE_00087_UFP N N GENERAL DEMAND COMPLETE UNDEFINED UNDEFINED VALID
VUE_00087_UHPDT N N NONE DEMAND COMPLETE UNDEFINED UNDEFINED VALID
</code>
the refresh failed without error. only 'NEEDS_COMPILE' value in COMPILE_STATE !!
If i try an 'alter compile' it's OK
If i try an execute DBMS_snapshot.refresh('MV_00087_BRANCARD', '?') it's ok
...but the refresh is not automatic ;((
any idea about this strange behavior ?
thanks for your help.

Any DDL or DML operation on base table can invalidate a materialized view
State of materialized views can be checked in dictionary view USER_MVIEWS or ALL_MVIEWS. and column- STALENESS
You can use
ALTER MATERIALIZED VIEW MV_Name COMPILE statement to validate the materialized view and get the correct state.
Thanks
Message was edited by:
user542366

Similar Messages

  • How to CREATE MATERIALIZED VIEW LOG (MV fast refresh) with some JOINS

    Hi @ all,
    i'm trying to create a MATERIALIZED VIEW LOG for a fast refresh of a MATERIALIZED VIEW.
    It works fine with a simple Request in the MATERIALIZED VIEW:
    CREATE MATERIALIZED VIEW MV_ZOTD43_P
    TABLESPACE GDII
    BUILD IMMEDIATE
    REFRESH FORCE AS
    SELECT * FROM ZOTD43_P;
    COMMIT;
    CREATE MATERIALIZED VIEW LOG ON ZOTD43_P
    TABLESPACE "GDII"
    WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
    call DBMS_MVIEW.REFRESH('MV_ZOTD43_P', 'f');
    But when I use a complex SQL-Request with some JOINS (one of the Table with spatial Data) in the MATERIALIZED VIEW, I get an error:
    CREATE MATERIALIZED VIEW MV_TEST
    TABLESPACE GDII
    BUILD IMMEDIATE
    REFRESH FORCE AS
    SELECT lptd04_p.sst_nr AS sst_nr,
    lptd03_p.aaaa AS aaaa,
    lptd04_geom.geom as geom
    FROM lptd04_p lptd04_p
    JOIN lptd01_p lptd01_p ON lptd01_p.cre_nr = lptd04_p.sst_nr
    JOIN lptd04_geom ON lptd04_geom.sst_nr = lptd04_p.sst_nr
    JOIN lptd03_p lptd03_p ON lptd03_p.lief_nr = lptd04_p.lief_nr;
    COMMIT;
    CREATE MATERIALIZED VIEW LOG ON LPTD04_P
    TABLESPACE "GDII"
    WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
    call DBMS_MVIEW.REFRESH('MV_TEST', 'f');
    Error report:
    SQL Error: ORA-12004: REFRESH FAST kann für Materialized View "GDI"."MV_GDI_SST_STAMM" nicht benutzt werden
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2255
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2461
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2430
    ORA-06512: in Zeile 1
    12004. 00000 - "REFRESH FAST cannot be used for materialized view \"%s\".\"%s\""
    *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.
    Am I doing something wrong or is it not possible CREATE MATERIALIZED VIEW LOG when the MATERIALIZED VIEW got some JOINS?
    Regards,
    Greq

    Thanks for the link Alessandro ,
    the error seems something to do with the Column-Type SDO_GEOMETRY, so
    i create a new thread in the Spatial Discussion forum:
    FAST REFRESHing of Oracle Materialized Views containing SDO_GEOMETRY column
    Regards,
    Greq

  • MATERIALIZED VIEW BECOMES INVALID AFTER REFRESH

    Hello All,
    I have wierd problem ,
    In my enviroinment we have a MATERIALIZED VIEW ,which is refreshed by a sheduled DBMS_SNAPSHOT.REFRESH Job post the refresh it becomes invalid and every time we have to compile it manually ,Could anybody help with a solution .Thanks a lot in Advance .
    DETAILS :
    ======
    VERSION:Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    HOST: IBM AIX

    Is the MV part of a refresh group?
    Post the command and parameters used by the scheduled job to do the refresh as well as the parameters you use when you do it manually.

  • Materialized view takes long to refresh

    On Oracle 11g2, I created a materialized view fast refresh on commit CREATE MATERIALIZED VIEW mv_case
    PARALLEL BUILD IMMEDIATE REFRESH FAST ON COMMIT ENABLE QUERY REWRITE AS
    SELECT p.jperson_id,offense_id,CASE_SENTENCE_DATE,court_ref,CASE_COURT_ORI,
      c.CASE_VERDICT_DATE,CASE_DOCKET,c.CASE_EXPUNGED,c.jcase_id,cc.CYCLEID_ID,
      p.rowid p_rowid,xc.rowid xc_rowid,c.rowid c_rowid,cxo.rowid cxo_rowid,cc.rowid cc_row_id
    FROM jperson p,jperson_x_jcase xc,jcase c,jcase_x_offense cxo,jcase_x_cycleid cc
    where p.jperson_id = xc.jperson_id(+) and xc.jcase_id = c.jcase_id(+)
      and c.jcase_id = cxo.jcase_id(+) and c.jcase_id=cc.jcase_id;
    create index idx_mv_case_pid on mv_case(jperson_id);
    ALTER TABLE mv_case ADD (CONSTRAINT PK_MV_CASE PRIMARY KEY(jcase_id,offense_id)) ;
    create index idx_mv_case_p_rowid on mv_case(p_rowid);
    create index idx_mv_case_xc_rowid on mv_case(xc_rowid);
    create index idx_mv_case_c_rowid on mv_case(c_rowid);
    create index idx_mv_case_cxo_rowid on mv_case(cxo_rowid);
    create index idx_mv_case_cc_rowid on mv_case(cc_row_id); I inserted one single row into one of the master table
    insert into jcase_x_offense (offense_id,jcase_id) values ('test_row3','test_row3');
    commit; The commit tooks a quite long. I looked into the trace file and the actual insert took 0.01 seconds but one of the internel DML took most of time. I copy the relevant TKPROF output for the internal DML belowINSERT INTO QAPF.MV_CASE SELECT /*+ NO_MERGE(JV$) */
      MAS$4.JPERSON_ID,JV$.OFFENSE_ID,MAS$2.CASE_SENTENCE_DATE,
      MAS$2.COURT_REF,MAS$2.CASE_COURT_ORI,MAS$2.CASE_VERDICT_DATE,
      MAS$2.CASE_DOCKET,MAS$2.CASE_EXPUNGED,MAS$2.JCASE_ID,
      MAS$0.CYCLEID_ID,MAS$4.ROWID,MAS$3.ROWID,MAS$2.ROWID,JV$.RID$,
      MAS$0.ROWID
      FROM ( SELECT MAS$.ROWID RID$  ,  MAS$.*  FROM  QAPF.JCASE_X_OFFENSE MAS$ WHERE ROWID IN
              (SELECT  /*+ HASH_SJ */ CHARTOROWID(MAS$.M_ROW$$) RID$
               FROM QAPF.MLOG$_JCASE_X_OFFENSE MAS$ WHERE MAS$.XID$$ = :1 )) JV$,
      JCASE_X_CYCLEID AS OF SNAPSHOT(:B_SCN)  MAS$0, JCASE AS OF SNAPSHOT(:B_SCN)  MAS$2,
      JPERSON_X_JCASE AS OF SNAPSHOT(:B_SCN)  MAS$3, JPERSON AS OF SNAPSHOT(:B_SCN)  MAS$4
      WHERE (MAS$4.JPERSON_ID=MAS$3.JPERSON_ID(+)
      AND MAS$3.JCASE_ID=MAS$2.JCASE_ID(+)
      AND MAS$2.JCASE_ID=JV$.JCASE_ID(+)
      AND MAS$2.JCASE_ID=MAS$0.JCASE_ID)
      AND NOT EXISTS (
        SELECT 1 FROM QAPF.MV_CASE SNA2$
        WHERE (SNA2$.P_ROWID = MAS$4.ROWID)
        AND (SNA2$.XC_ROWID = MAS$3.ROWID OR MAS$3.ROWID IS NULL )
        AND (SNA2$.C_ROWID = MAS$2.ROWID OR MAS$2.ROWID IS NULL )
        AND (SNA2$.CC_ROW_ID = MAS$0.ROWID OR MAS$0.ROWID IS NULL )
        AND JV$.RID$ IS NULL)
      AND NOT EXISTS (
        SELECT 1  FROM JCASE_X_OFFENSE MAS_INNER$, JCASE AS OF SNAPSHOT(:B_SCN)  MAS_OUTER$
        WHERE MAS$2.ROWID = MAS_OUTER$.ROWID AND JV$.RID$ IS NULL
        AND MAS_OUTER$.JCASE_ID=MAS_INNER$.JCASE_ID)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1     99.51     364.87     377012   17412972          1           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2     99.51     364.87     377012   17412972          1           0
    Rows     Row Source Operation
          0  LOAD TABLE CONVENTIONAL  (cr=17412968 pr=377012 pw=120527 time=0 us)
          0   FILTER  (cr=17412968 pr=377012 pw=120527 time=0 us)
    3363837    HASH JOIN RIGHT OUTER (cr=264914 pr=280254 pw=120527 time=35845080 us cost=299444 size=1029332286 card=3363831)
          1     VIEW  (cr=112490 pr=180864 pw=119722 time=0 us cost=30743 size=78 card=1)
          1      HASH JOIN SEMI (cr=112490 pr=180864 pw=119722 time=0 us cost=72627 size=208 card=1)
    11354346       TABLE ACCESS FULL JCASE_X_OFFENSE (cr=112488 pr=112447 pw=0 time=4814838 us cost=30703 size=749386770 card=11354345)
          1       TABLE ACCESS BY INDEX ROWID MLOG$_JCASE_X_OFFENSE (cr=2 pr=0 pw=0 time=0 us cost=1 size=142 card=1)
          1        INDEX RANGE SCAN IDX_MLOG$_XID_JCASE_X_OFFENSE (cr=1 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 98375)
    3363837     HASH JOIN  (cr=152424 pr=99390 pw=805 time=29973970 us cost=268690 size=766953468 card=3363831)
    2994042      INDEX FAST FULL SCAN JPERSON_I0 (cr=18134 pr=0 pw=0 time=772990 us cost=17450 size=134731845 card=2994041)(object id 83738)
    3363837      HASH JOIN  (cr=134290 pr=99390 pw=805 time=25292580 us cost=212128 size=615581073 card=3363831)
    3363837       HASH JOIN  (cr=69008 pr=34127 pw=805 time=4750330 us cost=101637 size=393568929 card=3363837)
    3363837        TABLE ACCESS FULL JCASE_X_CYCLEID (cr=33337 pr=33322 pw=0 time=2942460 us cost=33569 size=222013242 card=3363837)
    6586646        TABLE ACCESS FULL JCASE (cr=35671 pr=0 pw=0 time=1584102 us cost=35988 size=335918895 card=6586645)
    6586635       TABLE ACCESS FULL JPERSON_X_JCASE (cr=65282 pr=65263 pw=0 time=5446686 us cost=65632 size=434717844 card=6586634)
    3363837    FILTER  (cr=17148054 pr=96758 pw=0 time=0 us)
    3363837     MAT_VIEW ACCESS BY INDEX ROWID MV_CASE (cr=17148054 pr=96758 pw=0 time=0 us cost=7 size=40 card=1)
    32464070      INDEX RANGE SCAN IDX_MV_CASE_P_ROWID (cr=4489770 pr=15250 pw=0 time=19576798 us cost=3 size=0 card=7)(object id 98467)
          0    FILTER  (cr=0 pr=0 pw=0 time=0 us)
          0     NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=4 size=78 card=1)
          0      TABLE ACCESS BY USER ROWID JCASE (cr=0 pr=0 pw=0 time=0 us cost=1 size=45 card=1)
          0      INDEX RANGE SCAN JCASE_X_OFFENSE_I0 (cr=0 pr=0 pw=0 time=0 us cost=3 size=33 card=1)(object id 83623)Questions:
    1) what are the objects like JCASE AS OF SNAPSHOT(:B_SCN) ? Can I index them? I tried access it but got error
    select * from JCASE AS OF SNAPSHOT(:B_SCN) ;
    ORA-08187: snapshot expression not allowed here
    08187. 00000 - "snapshot expression not allowed here"
    *Cause:    A snapshot expression using AS OF was specified when not allowed.
    *Action:   Do not use the AS OF clause
    2) In the inline view following the firs FROM, it used ROWID in where clause. I tried create an index on ROWID, and error
    create index idx_jcase_offense_rid on JCASE_X_OFFENSE(rowid)
    ERROR at line 1:
    ORA-00904: : invalid identifier
    Note: I checked that I have indexes all fields in all where clauses in the DML except rowid.
    Thanks for help.

    sybrand_b wrote:
    1 Apparently Oracle is using Flashback technology when no materialized view logs have been set up
    As your MV is a complex MV it is not a candidate for FAST REFRESH ON COMMIT.
    I haven't looked closely at how 11.2 has changed the "fast refresh on commit" - but I would have expected it to raise an Oracle error when the OP tried to create the materialized view with that option if it were not possible.
    I think your first comment is probably the more important one - if the user sets up suitable materialized view logs on all the tables in the outer join then it's possible that the fast refresh could work properly.
    This is pure speculation, of course, based on the absence of an error message.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)
    +"Science is more than a body of knowledge; it is a way of thinking"+
    +Carl Sagan+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Materialized View - Point in time refresh

    I have a MV group which refreshes from a bunch of master tables. The master tables are constantly getting updated from an OLTP application. In this scenario, I want all the MVs to hold data which was available at the time the refresh started and not the changes after that.
    Eg:
    Master tables are T1, T2 ... T20 refresh to MVs T1_MV, T2_MV ...T20_MV
    All the MVs T1_MV to T20_MV are in a refresh group.
    At 3 PM: Execute an explicit refresh for the MV refresh group
    At 3:05 PM: OLTP application inserts a record into table T5 & commits
    At 3:06 PM (rather any time after 3:05 PM): Refresh of T5_MV happens. Will the latest insert get captured in T5_MV? I actually don't want this to happen for my requirement, because I want the data captured as of 3 PM into the MVs.
    The Oracle Advanced Replication guide says the following about Materialized Views -
    +"A materialized view is a replica of a target master from a single point in time."+
    From the above line, it looks like by default this will not be captured in the MV. Can someone please confirm my understanding ?

    MVs in a Refresh Group when refreshed as a Refresh Group are refreshed as of the same point in time.
    So if the Refresh Group begins at 3:00pm and ends at 3:25pm, all the MVs in that group reflect the data as in the source tables as of 3:00pm, ignoring any updates to source tables after 3:00pm (i.e. while the Group is being refreshed).
    However, if you refresh MVs individually, then each MV is refreshed at it's relative point in time -- so individual Refreshs of MVs would not be to the same point in time.
    How have you defined the Refresh Group ?
    How do you execute the Refresh for the whole Group ? What PLSQL procedure do you use ? What parameters do you use ?
    Ensure that you do not execute an individual MV Refresh.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Materialized view (creating and complete refresh)

    Good day.
    I have a huge query that is used to create a materialized view. The query consist of 9 joins, a lot of aggregations, some subqueries, so we can say it is rather huge. The query itself executes for about 30 seconds and returns about 200 rows. The materialized view creates and refreshes for more than 30 minutes. Can someone please explain me the mechanism of materialized view creation which causes such bad performance.
    We use Oracle Database 9.2.0.4.
    Thank you in advance.

    I've fount the solution. May be it will be useful for someone not regarding that 9.2 database is less used today than 10.2.
    I studied carefully the plan of the query and the plan of insert statement that is used when creating materialized view and found the cause of trouble. Insert statements generates VIEW PUSHED PREDICATE and BITMAP CONVERSION FROM ROWIDS when parsing. Bitmap conversion can be removed by setting environment parameter btree_bitmap_plans to false (a well-known issue), but I decided not ot change the production environment. The pushed predicate can be removed by using hint NO_PUSH_PRED to each subquery used in a materialized view. This step reduced the time of materialized view creation and execution to about a minute.
    Thank everyone who tried to help.

  • Materialized view logs for Fast refreshes

    Hi,
    I created MV and MV logs on the base table/main table. I set the base table in NOLOGGING MODE. so ofcourse redo is not gonna generate during DML but i wanted to know that:
    Will NOLOGGING effect the MV logs for fast refreshes?
    I came up on conclusion that MV logs are nothing to do with Redo Logs and would have no impact on MV logs for fast refresh since i have set my all base table in NOLOGGING MODE.
    Looking forward for expert opinion.
    REGARDS,

    Though I'm not an expert...
    SQL> alter table emp nologging;
    Table altered.
    SQL> create materialized view log on emp;
    Materialized view log created.
    SQL> select * from tab;
    TNAME TABTYPE CLUSTERID
    EMP TABLE
    BONUS TABLE
    SALGRADE TABLE
    RUPD$_EMP TABLE
    MLOG$_EMP TABLE
    SQL> insert into emp values(1000,'Matt','Test',100,sysdate,1000,1000,10,11,11);
    1 row created.
    SQL> select *From mlog$_emp;
    EMPNO SNAPTIME$ D O
    CHANGE_VECTOR$$
    1000 01-JAN-00 I N
    FEFF

  • Create materialized view is failing when refresh fast is used

    version 10.2.0.4 on solaris
    This statement is working fine
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    BUILD IMMEDIATE
    as
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    The statement with fast refresh is failing with this error message
    ERROR at line 18:
    ORA-12018: following error encountered during code generation for
    "TABLE1"
    ORA-00942: table or view does not exist
    Here is the statement
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    USING INDEX TABLESPACE MIS_CURI01
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    Any idea what's going wrong here. Thanks for your help in advance.
    Edited by: user11319873 on Jun 30, 2010 4:17 PM

    Refresh FAST requires that
    a. An MV Log (Snapshot Log) be created on the source table
    b. The user doing the refresh (i.e. the account that the DBLink uses) has SELECT privilege on the MV Log.
    Hemant K Chitale

  • Oracle Materialized view tables not getting refreshed automatically.

    At Destination:--
    CREATE MATERIALIZED VIEW PROG_MEDIA
    TABLESPACE ONA_TS1
    BUILD IMMEDIATE
    REFRESH FAST with rowid
    START WITH SYSDATE
    NEXT SYSDATE+1/96
    AS (select /*+ PARALLEL(a,6) */ * from PROG_MEDIA@onair a);
    exec dbms_mview.refresh('PROG_MEDIA','C');
    At Source:--
    CREATE MATERIALIZED VIEW LOG ON ONAIR.PROG_MEDIA
    TABLESPACE MVLOG
    WITH ROWID;
    Fired manually:--
    13:00:43 SQL> exec dbms_mview.refresh('PROG_MEDIA','C');
    PL/SQL procedure successfully completed.
    At source:--
    13:18:35 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
    PROG_MEDIA_ID
    PROG_MEDIA_NAME
    102226
    test
    At Destination:--
    14:03:28 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
    PROG_MEDIA_ID PROG_MEDIA_NAME
    102226 UTSAV-5-162077
    JOB LOG_USER THIS_DATE LAST_DATE_TIME NEXT_DATE_TIME INTERVAL FAILURES WHAT
    242 ONAIR 17-05-11 14:17:24 SYSDATE+1/96 7 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
    A"');
    242 ONAIR 17-05-11 14:32:25 SYSDATE+1/96 8 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
    A"');
    1> I have scheduled this refresh job for every 15mins, but its not getting executed. Also my job_queue_process is '20'. Whenever i execute it manually it get's refresh.
    2> I can schedule a cron for the same for every 15mins but i really dont want to do it.
    Kindly help me out.

    Hi,
    I have created MV_CAPABILITIES_TABLE & executed below commands:--
    17:56:54 SQL> EXECUTE DBMS_MVIEW.EXPLAIN_MVIEW ('"ONAIR"."PROG_MEDIA"');
    PL/SQL procedure successfully completed.
    17:57:26 SQL> SELECT capability_name, possible, SUBSTR(related_text,1,8)
    17:57:27 2 AS rel_text, SUBSTR(msgtxt,1,60) AS msgtxt
    17:57:27 3 FROM MV_CAPABILITIES_TABLE
    17:57:27 4 ORDER BY seq;
    CAPABILITY_NAME P REL_TEXT MSGTXT
    PCT N
    PCT N
    REFRESH_COMPLETE Y
    REFRESH_COMPLETE Y
    REFRESH_FAST Y
    REFRESH_FAST Y
    REWRITE N
    REWRITE N
    PCT_TABLE N PROG_MED relation is not a partitioned table
    PCT_TABLE N PROG_MED relation is not a partitioned table
    REFRESH_FAST_AFTER_INSERT Y
    REFRESH_FAST_AFTER_INSERT Y
    REFRESH_FAST_AFTER_ONETAB_DML Y
    REFRESH_FAST_AFTER_ONETAB_DML Y
    REFRESH_FAST_AFTER_ANY_DML Y
    REFRESH_FAST_AFTER_ANY_DML Y
    REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
    REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
    REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
    REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
    REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
    REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
    REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_GENERAL N materialized view cannot support any type of query rewrite
    REWRITE_GENERAL N materialized view cannot support any type of query rewrite
    REWRITE_GENERAL N query rewrite is disabled on the materialized view
    REWRITE_GENERAL N query rewrite is disabled on the materialized view
    REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
    REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
    PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
    PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
    34 rows selected.
    Elapsed: 00:00:00.09
    What to be done next?
    Also i fired the job manually by:--
    17:38:02 SQL> set serveroutput on
    17:39:45 SQL> EXEC DBMS_JOB.RUN(242);
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.48

  • Create materialized view as part of refresh group

    Hello,
    When I create a materialized view in 11g it automatically creates its own refresh group. How can I create the materialized group as part of an existing refresh group? (I know I can drop the individual refresh group and add the mview to the main refresh group but that is a pain).
    Thank you,

    >
    How can I create the materialized group as part of an existing refresh group?
    >
    You can't - you need to add the MV to the existing refresh group.
    See the Add Procedure of the DBMS_REFRESH package
    http://docs.oracle.com/cd/B28359_01/server.111/b28327/rarrefreshpac.htm

  • Problem when try to get the next refresh date of a materialized view

    I have a materialized view set to auto refresh(e.g hourly), I need to query this date and display in the report. I create a procedure which return the NEXT_DATE from the ALL_REFRESH_CHILDREN table, the procedure and the view all in schema HK3XDDB.
    If I login as sys, dba in the sql plus and query the procedure, it return the next date, but if I login as normal user which has permission to execute all procedures, it didn't return anything, so I change ALL_REFRESH_CHILDREN to USER_REFRESH_CHILDREN, still no luck. But the details from the USER_MVIEWS can be returned, just won't return anything in the REFRESH one. How to query the next date out?
    Another strange thing is, if I login as sys dba, it return the next date, but if I use a select next_date into statement in the procedure it will throw a data not found error.
    I stuck here for several hours just can't figure it out, any suggestions are welcome,
    Cheers

    Thank you for the reply. It's same with USER_REFRESH_CHILDREN, I can get the result when I run the procedure in SQL PLUS login as sys dba, but if I run the procedure using normal user which has permission to run any procedure, then nothing return. It might be a permission problem but I just can't figure out why.
    Let me explain in detailed:
    Schema HKXDDB, this schema has procedure TestProcedure, in the procedure, I have two ref cursor return, one is for select * from USER_JOBs (or from USER_REFRESH_CHILDREN, I have tried both), one is for select * From USER_MVIEWS, this schema has the materialized view. User HKDWUser has permission to run any procedures, so when this user run the TestProcedure which is own by HKXDDB, the cursor that select from USER_MVIEWS can return results which are materialized views owned by HKXDDB, but the cursor that select form USER_JOBS or USER_REFRESH_CHILDREN always return no rows.
    Any permission I need to assign to HKDWUSER to get the jobs or fresh group that owned by HKXDDB?
    Cheers

  • How can I manually refresh a Materialized View

    Hi,
    There's a materialized view created in 2006 as under:
    CREATE MATERIALIZED VIEW "schema"."mv_name"
    USING INDEX
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE AS SELECT * FROM "table_name@dblink;
    The problem is that the last refresh was done in Aug. I want to manually refresh this materialized view right now as there is a procedure based on this MV and its not showing the right data as the above materialized view has not been refreshed, so the data for this month is not showing.
    Please let me know how I can refresh that MV right now.
    Also do I need to change the refresh option. How can I change it so that the MV refreshes itself every second.
    Thanks

    Also do I need to change the refresh option. How can
    I change it so that the MV refreshes itself every
    second. Every second? Why do you want to do that?? Perhaps waht you really want is refresh the MV on commit.

  • Problem in materialized view

    Hello everybody!!!
    I used the following script in order to see the automatic refresh of data contained in a materialized view.
    I used the following script in SCOTT schema:
    create materialized view log on emp
    with rowid (job,sal)
    including new values
    create materialized view emp_mv
    build immediate
    refresh fast on commit
    as
    select job , sum(sal) sum_sal
    from emp
    group by job
    The problem is that after i update the sal column (and commit it) of an employee and selecting from the emp_nv , I DO NOT see any difference , although the materialized view log has been updated successfully!!!
    Under which circumstances the materialized view would be updated as well?
    Simon.

    What is job_queue_processes set to on your system? Materialized view refreshes are generally done as background jobs, so that initializiation parameter needs to be set to a non-zero value.
    Justin

  • Materialized View Not Refreshing

    Hello,
    I have a materialized view that is not refreshing. I tried to set it to refresh it every 24 hours by specifying the following:
    REFRESH COMPLETE START WITH sysdate+0 NEXT sysdate+1
    The database modified it to be:
    REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT sysdate+1
    I'm not sure why this materialized view is not being refreshed. Here is the full DDL for the view:
    CREATE MATERIALIZED VIEW "MBMMASTER"."CLINIDXINVTRANSDATA"
    ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "FAC_DATA"
    BUILD IMMEDIATE
    USING INDEX
    REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT sysdate+1
    USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS SELECT
    IIT.Group_ZZ as IDXGroupKey
    , IIT.Prov as IDXProviderKey
    , IIT.U_Second_Phys as IDXSecondaryProviderKey
    , IIT.Div as IDXDivisionKey
    , IIT.Loc as IDXLocationKey
    , IIT.Billing_Area as IDXBillingAreaKey
    , IIT.Proc as IDXProcedureKey
    , IIT.Post_pd as IDXPostPeriod
    , Max(CASE
    WHEN SIBP.FacultyPK is Null Then PIBP.FacultyPK
    WHEN EXISTS (
    SELECT *
    FROM FacultyAdmin.FacAdmAppointment APP
    WHERE SIBP.FacultyPK = APP.FacultyPK
    AND APP.AdmApptTypePK = 'APT0001021' /* MidLevel Track */
    AND APP.AdmRankListPK = 'RKL0001141' /* MidLevel Rank */
    AND IIT.SER_DT BETWEEN APP.AdmApptStartDate AND NVL(APP.AdmApptEndDate,IIT.SER_DT)
    ) THEN SIBP.FacultyPK
    ELSE PIBP.FacultyPK
    END) AS FacultyPK
    , SUM(IIT.RVU
    ) as IDXRVU
    , SUM(
    CASE
    WHEN Sign(IIT.RVU) = Sign(IIT.RVU_WORK_COMP) THEN IIT.RVU_WORK_COMP
    ELSE IIT.RVU_WORK_COMP * -1
    END
    ) as IDXWorkRVU
    , SUM(
    CASE
    WHEN Sign(IIT.RVU) = Sign(IIT.RVU_EXPENSE_COMP) THEN IIT.RVU_EXPENSE_COMP
    ELSE IIT.RVU_EXPENSE_COMP * -1
    END
    ) as IDXExpenseRVU
    , SUM(
    CASE
    WHEN Sign(IIT.RVU) = Sign(IIT.RVU_MALPRATICE_COMP) THEN IIT.RVU_MALPRATICE_COMP
    ELSE IIT.RVU_MALPRATICE_COMP * -1
    END
    ) as IDXMalpracticeRVU
    FROM IDXInvTrans@DW IIT
    , FacultyMaster.FacIDXBARProvider PIBP
    , FacultyMaster.FacIDXBARProvider SIBP
    where IIT.Prov = PIBP.IDXBARProviderKey
    AND IIT.U_Second_Phys = SIBP.IDXBARProviderKey(+)
    AND IIT.pay_code_num = 99
    AND IIT.Post_Pd >= 10101
    GROUP BY
    IIT.Group_ZZ
    , IIT.Prov
    , IIT.U_Second_Phys
    , IIT.Div
    , IIT.Loc
    , IIT.Billing_Area
    , IIT.Proc
    , IIT.Post_pd;
    Thanks in advance,
    Chris

    I had quite similar problem/question. And un/fortunately answered it by myself, nobody was interested in help :)
    For the first sight: two "concurrent" statements have been used: ON DEMAND and START WITH. I wonder why database changed good code.
    Look into my topic: How to recreate materialized view and maintain priviledges?
    Look also here: Re: error on "CREATE MATERIALIZED VIEW" for more details.
    HTH, Rev

  • Materialized view problem ORA-00904: "from$_subquery$_ error

    Hello everyone,
    I've created data warehouse star schema and I'm trying to set up materialized view. DBMS_MVIEW.EXPLAIN_MVIEW passes and also the select query passes and is executed with no problems but when I try to CREATE MATERIALIZED VIEW... then error ORA-00904: "from$_subquery$_003"."SERVICE_ID_2_2": invalid identifier pops-up. How does Oracle 9i (9.2.0.1.0) managed to do this ? How to make it to work ?
    This is the query, and the schema:
    CREATE MATERIALIZED VIEW analiza_profitabilnosti
    BUILD IMMEDIATE
    REFRESH FAST
    ON COMMIT
    AS
    select
    GROUPING_ID(t.y,t.q,t.m,t.w,t.d,s.service_type,s.service_id,c.customer_category) as g_id,
    t.y, t.q, t.m, t.w, t.d,
    s.service_type , s.service_id ,
    c.customer_category ,
    COUNT(*) as c_star,
    SUM(cost) cost, COUNT(cost) c_cost,
    SUM(number_of_units) number_of_units, COUNT(number_of_units) as c_number_of_units
    from fact f
    inner join timeline t on f.datum = t.datum
    inner join service s on f.service_id = s.service_id
    inner join customer_category c on f.customer_category=c.customer_category
    group by
    ROLLUP(t.y, t.q, t.m, t.w, t.d),
    ROLLUP(s.service_type, s.service_id),
    ROLLUP (c.customer_category)
    and the schema:
    FACT (
    DATUM DATE,
    HOST_ID NUMBER,
    SERVICE_ID NUMBER (5),
    CALLED_PREFIX_ID NUMBER (10),
    CUSTOMER_CATEGORY NUMBER,
    TRAFIC_PERIOD_ID NUMBER (5),
    CALL_DURATION NUMBER,
    COST NUMBER,
    NUMBER_OF_UNITS NUMBER,
    NUMBER_OF_CALLS NUMBER)
    TIMELINE (
    Y VARCHAR2 (5),
    Q VARCHAR2 (5),
    M VARCHAR2 (5),
    W VARCHAR2 (5),
    D VARCHAR2 (5),
    DATUM DATE NOT NULL)
    SERVICE (
    SERVICE_ID NUMBER (5) NOT NULL,
    SERVICE_CODE VARCHAR2 (15) NOT NULL,
    SERVICE_NAME VARCHAR2 (63),
    SERVICE_TYPE NUMBER (5),
    SERVICE_TYPE_CODE VARCHAR2 (4) NOT NULL,
    S_ID NUMBER (5))
    CUSTOMER_CATEGORY (
    CUSTOMER_CATEGORY_NAME VARCHAR2 (65) NOT NULL,
    CUSTOMER_CATEGORY NUMBER NOT NULL)
    Thanks,
    Igor

    Yes, thank you. I suspected that version is problem, and patch 9.2.0.6 helped. It works under 9.2.0.6

Maybe you are looking for