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

Similar Messages

  • Materialized Views Not Refreshing

    I have created several materialized views and I am having a problem with them never refreshing even though their refresh times are specified in the create statement. Here is the SQL statement for one of them.
    create MATERIALIZED view autonomy_mvw
         nocache
         logging
         noparallel
         build immediate
         refresh complete
         start with to_date(sysdate,'dd-mon-yyyy hh24:mi:ss')
         next sysdate + 18/24
    as
         select c.contract_seq,
              c.contract_number contract,
    cast('' as VARCHAR2(1)) contract_mod,
              cast('' as VARCHAR2(1)) do,
              cast('' as VARCHAR2(1)) do_seq,
              cast('' as VARCHAR2(1)) do_mod_number,
              c.contract_number co_do,
              c.contract_name title,
              c.contract_remarks description,
              c.contract_effective_date award_date,
              to_char(c.contract_performance_end_date) originalpop,
              to_char(cont_perform_end_date(c.contract_seq)) currentpop,
              c.control_group controlgroup,
              c.fiscal_year_execution fy,
    c.quarter,
              nvl(CON_PENDING_ROLLUP_AMOUNT(c.contract_seq),0) pendingamt,
              nvl(CON_OBLIGATED_ROLLUP_AMOUNT(c.contract_seq),0) originalamt,
              cont_majcoms_comma(c.contract_seq) majcom,
    cont_installations_desc_comma(c.contract_seq) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end     pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'')     end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              c.contract_status status,
              cast('' as VARCHAR2(1)) active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              c.funds_type fund_type,
              c.contract_instr_num
         from contract c,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where c.contractor_number = con.contractor_number
         and c.control_group = cgl.control_group(+)
         and c.pm_seq = pocPM.poc_user_seq(+)
         and c.cm_seq = pocCM.poc_user_seq(+)
         and c.bco_seq = pocBCO.poc_user_seq(+)
         and c.contract_instr_num <> 'D'
         and c.contract_status in ('AC', 'NEW')     
         union
         select c.contract_seq,
              c.contract_number contract,
              cmod.contract_mod_num contract_mod,
              cast('' as VARCHAR2(1)) do,
              cast('' as VARCHAR2(1)) do_seq,
              cast('' as VARCHAR2(1)) do_mod_number,
              c.contract_number||'/'||cmod.contract_mod_num co_do,
              c.contract_name title,
              c.contract_remarks description,
              c.contract_effective_date award_date,
              to_char(c.contract_performance_end_date) originalpop,
              to_char(cont_perform_end_date(c.contract_seq)) currentpop,
              c.control_group controlgroup,
              cmod.fiscal_year_execution fy,
    cmod.quarter,
              nvl(cmod.contract_mod_committed_amt,0) pendingamt,
              nvl(cmod.afcee_oblig_contract_mod_amt, 0) originalamt,
              cont_majcoms_comma(c.contract_seq) majcom,
              cont_installations_desc_comma(c.contract_seq) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              c.contract_status status,
              cast('' as VARCHAR2(1)) active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              c.funds_type fund_type,
              c.contract_instr_num
         from contract c,
              contract_modification cmod,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where c.contract_seq = cmod.contract_seq
         and c.contractor_number = con.contractor_number
         and c.control_group = cgl.control_group(+)
         and c.pm_seq = pocPM.poc_user_seq(+)
         and c.cm_seq = pocCM.poc_user_seq(+)
         and c.bco_seq = pocBCO.poc_user_seq(+)
         and c.contract_instr_num <> 'D'
         and c.contract_status in ('AC', 'NEW')
         union
         select c.contract_seq,
              c.contract_number contract,
              cast('' as VARCHAR2(1)) contract_mod,
              do.do_number do,
              to_char(do.do_seq) do_seq,
              cast('' as VARCHAR2(1)) do_mod,
              c.contract_number||'-'||do.do_number co_do,
              do.do_title title,
              do.do_description description,
              do.afcee_obligated_do_date award_date,
              to_char(do.do_end_date) originalpop,
         to_char(do_mod_end_date(do.do_seq)) currentpop,
              do.control_group controlgroup,
              do.fiscal_year_execution fy,
    do.quarter,
              nvl(DO_PENDING_ROLLUP_AMOUNT(do.do_seq),0) pendingamt,
              nvl(DO_OBLIGATED_ROLLUP_AMOUNT(do.do_seq),0) originalamt,
    do_majcoms_comma(do.do_seq, null) majcom,
    do_installations_desc_comma(do.do_seq, null) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              do.do_status status,
              do.do_actv_status active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              do_fundtypes_comma(do.do_seq,null) fund_type,
              c.contract_instr_num
         from delivery_order do,
              contract c,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where do.contract_seq = c.contract_seq
         and c.contractor_number = con.contractor_number
         and do.control_group = cgl.control_group(+)
         and do.pm_seq = pocPM.poc_user_seq(+)
         and do.cm_seq = pocCM.poc_user_seq(+)
         and do.bco_seq = pocBCO.poc_user_seq(+)
         and do.do_status in ('CURR')
         and do.do_actv_status in ('RESV','ANTC','FORE','COMM','OBLG','FIN_INV')
         union
         select c.contract_seq,
              c.contract_number contract,
              ''contract_mod,
              do.do_number do,
              to_char(do.do_seq) do_seq,
              domod.do_mod_number do_mod,
              c.contract_number||'-'||do.do_number||'-'||domod.do_mod_number co_do,
              do.do_title title,
              domod.do_mod_description description,
              domod.afcee_obligated_do_mod_date award_date,
              to_char(do.do_end_date) originalpop,
    to_char(do_mod_end_date(do.do_seq)) currentpop,
              domod.control_group controlgroup,
              domod.fiscal_year_execution fy,
    domod.quarter,
              (nvl(domod.do_mod_committed_amount,0) + nvl(domod.reserved_amount,0)+ nvl(domod.anticipated_amount,0)
                   + nvl(domod.forecasted_amount,0)) pendingamt,
              (nvl(domod.afcee_obligated_do_mod_amount, 0)) originalamt,
    do_majcoms_comma(do.do_seq, domod.do_mod_number) majcom,
    do_installations_desc_comma(do.do_seq, domod.do_mod_number) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              do.do_status status,
              do.do_actv_status active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              do_fundtypes_comma(do.do_seq,domod.do_mod_number) fund_type,
              c.contract_instr_num
         from delivery_order do,
              delivery_order_modification domod,
              contract c,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where do.do_seq = domod.do_seq
         and do.contract_seq = c.contract_seq
         and c.contractor_number = con.contractor_number
         and do.control_group = cgl.control_group(+)
         and do.pm_seq = pocPM.poc_user_seq(+)
         and do.cm_seq = pocCM.poc_user_seq(+)
         and do.bco_seq = pocBCO.poc_user_seq(+)
         and domod.do_mod_status in ('CURR')
         and domod.do_mod_actv_status in ('RESV','ANTC','FORE','COMM','OBLG','DEOBLG','FIN_INV');
    As you can see, I cannot use the On Commit refresh method because I violate several of the requirements in order to use the On Commit refresh method. I do not have a materialized view logs.
    I did the following select from all_mviews:
    1 select
    2 MVIEW_NAME,
    3 UPDATABLE,
    4 UPDATE_LOG,
    5 REWRITE_ENABLED,
    6 REWRITE_CAPABILITY,
    7 REFRESH_MODE,
    8 REFRESH_METHOD,
    9 BUILD_MODE,
    10 LAST_REFRESH_TYPE,
    11 LAST_REFRESH_DATE,
    12 STALENESS
    13 from all_mviews
    14* where mview_name = 'AUTONOMY_MVW'
    MVIEW_NAME U UPDATE_LOG R REWRITE_C REFRES REFRESH_ BUILD_MOD LAST_REF LAST_REFR STALENESS
    AUTONOMY_MVW N N NONE DEMAND COMPLETE IMMEDIATE COMPLETE 17-NOV-05 STALE
    I then called the dbms_mview package to force a REFRESH on this view and then re-ran the above sql
    MVIEW_NAME U UPDATE_LOG R REWRITE_C REFRES REFRESH_ BUILD_MOD LAST_REF LAST_REFR STALENESS
    AUTONOMY_MVW N N NONE DEMAND COMPLETE IMMEDIATE COMPLETE 04-MAY-06 STALE
    I noticed that while it was refreshed it shows as stale.
    How do I get this materialized view (and my other ones) to refresh in a regular manner?
    Thanks
    Richard Anderson

    Here is what I got when I ran the sql you provided. BTW, I increased the substr size for the "Command" to 70 so I could see the whole thing. I have 6 materialized views in this instance but one of them has a compile_state of "ERROR" and so it doesn't show in the job queue. All the others show up.
    Job User Schem Last Date Next Date B Failed Command
    9 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_CON_DO_REPORT_MVW"');
    51 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."MIEN_FY_MV"');
    4 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_ALL_STATUS_AMT_REPORT_MVW"');
    7 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_AMOUNT_REPORT_MVW"');
    31 MXT MXT 04.05.2006 16:58 04.05.2006 17:28 N 0 dbms_refresh.refresh('"MXT"."PMR_TEST_MVW"');
    Rick Anderson
    PS, this list was run on my DEV server so it doesn't have the AUTONOMY_MVW at all but both my DEV and PROD instances are having the same issues.
    I downloaded Oracle SQL Developer and used it to look at the materialized views and they have a details tab which contained the following:
    "Name"     "Value"
    "OWNER"     "MXT"
    "MVIEW_NAME"     "PMR_AMOUNT_REPORT_MVW"
    "CONTAINER_NAME"     "PMR_AMOUNT_REPORT_MVW"
    "QUERY_LEN"     "31020"
    "UPDATABLE"     "N"
    "UPDATE_LOG"     ""
    "MASTER_ROLLBACK_SEG"     ""
    "MASTER_LINK"     ""
    "REWRITE_ENABLED"     "N"
    "REWRITE_CAPABILITY"     "NONE"
    "REFRESH_MODE"     "DEMAND"
    "REFRESH_METHOD"     "COMPLETE"
    "BUILD_MODE"     "IMMEDIATE"
    "FAST_REFRESHABLE"     "NO"
    "LAST_REFRESH_TYPE"     "COMPLETE"
    "LAST_REFRESH_DATE"     "04-MAY-06"
    "STALENESS"     "UNKNOWN"
    "AFTER_FAST_REFRESH"     "NA"
    "UNKNOWN_PREBUILT"     "N"
    "UNKNOWN_PLSQL_FUNC"     "Y"
    "UNKNOWN_EXTERNAL_TABLE"     "N"
    "UNKNOWN_CONSIDER_FRESH"     "N"
    "UNKNOWN_IMPORT"     "N"
    "COMPILE_STATE"     "VALID"
    "USE_NO_INDEX"     "N"
    Message was edited by:
    RichardAnderson

  • Materialized view not fast refreshable

    I need to calculate a moving total in a materialized view - that is, calculate subtotal for rows starting at current row up to the first row.
    I am using a window function, as shown below.
    The problem is, MVs using window functions are not fast refreshable, and I need this MV to be fast refreshable.
    Is there any other way of getting the moving total without using a window function?
    CREATE MATERIALIZED VIEW BIL_BI_OPDTL_MV_11_TST
    --REFRESH FAST ON DEMAND
    AS
    SELECT
    fact.txn_time_id txn_time_id
    , fact.effective_time_id close_time_id
    , prntmv.parent_group_id
    , jgd.parent_group_id sales_group_id
    , fact.lead_id
    , fact.opp_open_status_flag
    , fact.win_loss_indicator
    , fact.forecast_rollup_flag
    ,fact.rev_flag1
    , SUM(fact.rev_flag1) OVER (PARTITION BY
    fact.effective_time_id , prntmv.parent_group_id
    , fact.lead_id, fact.opp_open_status_flag, fact.win_loss_indicator, fact.forecast_rollup_flag
    , to_number(to_char(opty_creation_date,'J'))
    , to_number(to_char(opty_conversion_date,'J'))
    ORDER BY fact.lead_id
    ROWS UNBOUNDED PRECEDING) moving_total
    , to_number(to_char(opty_creation_date,'J')) opty_creation_time_id
    , to_number(to_char(opty_conversion_date,'J')) opty_conversion_time_id
    ,count(*) cnt
    FROM bil.bil_bi_opty_ld_f_tst fact, bil_bi_rs_grp_mv rgmv, bil_bi_rs_grp_mv prntmv,
    jtf.jtf_rs_groups_denorm jgd
    WHERE rgmv.sales_group_id = fact.sales_group_id
    and rgmv.salesrep_id = fact.salesrep_id
    AND fact.sales_group_id = jgd.group_id
    AND prntmv.sales_group_id = jgd.parent_group_id
    AND prntmv.umarker in ('top_groups', 'groups')
    AND jgd.active_flag='Y'
    group by
    fact.txn_time_id,
    fact.effective_time_id
    , prntmv.parent_group_id
    , jgd.parent_group_id
    , fact.lead_id
    , fact.opp_open_status_flag
    , fact.win_loss_indicator
    , fact.forecast_rollup_flag
    , fact.rev_flag1
    , to_number(to_char(opty_creation_date,'J'))
    , to_number(to_char(opty_conversion_date,'J'))

    Please post your question at
    General Database Discussions
    for faster response

  • Materialized view not properly refreshing

    Hi,
    As materialized view is not refreshing properly. we compare the sum of hashcode materialized view with the sum of hash code of the base view or table the materialized view is defined. If it's found equal then materialized view got refreshed succesfully else not.
    But in below example the column value is interchanged in between the row eventhough hashcode is same.
    Is there any other way to find the materialized view got refreshed successfully or not.
    SQL> create table temp as select object_name, subobject_name from user_objects where rownum<3;
    Table created
    SQL> select * from temp;
    OBJECT_NAME SUBOBJECT_NAME
    ATP_BN_I_1
    ATP_START_END_DATE_I_2
    SQL> create materialized view mv1 as select * from temp;
    Materialized view created
    SQL> select * from mv1;
    OBJECT_NAME SUBOBJECT_NAME
    ATP_BN_I_1
    ATP_START_END_DATE_I_2
    SQL> select sum(nvl(ora_hash("OBJECT_NAME"||"SUBOBJECT_NAME"),0)) from temp;
    SUM(NVL(ORA_HASH("OBJECT_NAME"
    4852176374
    SQL> select sum(nvl(ora_hash("OBJECT_NAME"||"SUBOBJECT_NAME"),0)) from MV1;
    SUM(NVL(ORA_HASH("OBJECT_NAME"
    4852176374
    SQL> UPDATE TEMP SET OBJECT_NAME=SUBOBJECT_NAME,SUBOBJECT_NAME=OBJECT_NAME;
    2 rows updated
    SQL> COMMIT;
    Commit complete
    SQL> select * from mv1;
    OBJECT_NAME SUBOBJECT_NAME
    ATP_BN_I_1
    ATP_START_END_DATE_I_2
    SQL> select * from temp;
    OBJECT_NAME SUBOBJECT_NAME
    ATP_BN_I_1
    ATP_START_END_DATE_I_2
    SQL> select sum(nvl(ora_hash("OBJECT_NAME"||"SUBOBJECT_NAME"),0)) from MV1;
    SUM(NVL(ORA_HASH("OBJECT_NAME"
    4852176374
    SQL> select sum(nvl(ora_hash("object_name"||"subobject_name"),0)) from temp;
    select sum(nvl(ora_hash("object_name"||"subobject_name"),0)) from temp
    ORA-00904: "subobject_name": invalid identifier
    SQL> select sum(nvl(ora_hash("OBJECT_NAME"||"SUBOBJECT_NAME"),0)) from temp;
    SUM(NVL(ORA_HASH("OBJECT_NAME"
    4852176374
    Any help really appreciated.
    Thanks in advance.

    unique wrote:
    Is there any other way to find the materialized view got refreshed successfully or not.You can look at the last_refresh_date and staleness columns of all_mviews: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_1105.htm#REFRN20139
    Or maybe use the all_mview_refresh_times view: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_1104.htm#sthref1068
    Regards,
    Rob.

  • Materialized view - fast refresh not working on joins

    Hello,
    Is it true that fast refresh for materialized view is not possible when I do a union of 2 tables, although both tables have materialized view logs ?

    there are a number of restrictions with fast refresh, read Materialized View Fast Refresh Restrictions and ORA-12052 [ID 222843.1]
    edit: his royal kyteness has posted on this before
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6506967884606
    Edited by: deebee_eh on Apr 25, 2012 3:13 PM

  • Order by in MATERIALIZED VIEW not work successfully with first column (ID)

    Dears,
    I am trying to create a Materialized View as below:
    CREATE MATERIALIZED VIEW HR.MV_EMP
    PCTFREE 10
    MAXTRANS 255
    TABLESPACE users
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    BUILD IMMEDIATE
    REFRESH ON DEMAND
    AS
    SELECT *
    FROM employees
    where rownum < 5000 order by employee_id desc ;But while querying the MATERIALIZED VIEW, it did not work successfully as the data did not appear in the accurate order.
    I tried to create the same MATERIALIZED VIEW but order by another column (Column Date), it worked successfully and the data appeared in the accurate order.
    It means that MATERIALIZED VIEW not work successfully with the first column (id).
    Can you please help me in this ?
    Thanks & regards,,

    A few pointers :
    1. As has been pointed out, the ROWNUM has been incorrectly placed. ROWNUM values are assigned as rows are fetched from the source before the ORDER BY. You need to ORDER BY first (in a SubQuery) and then ROWNUM afterwards (outside the SubQuery).
    2. I wonder why you want only the last 5000 EMPLOYEE_IDs. What if Employee_ID 1 is still an active employee (he is the founder, first employee and CEO ?). There could be very many "low" EMPLOYEE_IDs that are still active.
    3. Logically I would expect some filter other than the ROWNUM ... ORDER BY to be used to select candidate rows. Then, an ORDER BY in the CREATE query would be unnecessary.
    4. When querying the Materialized View you must explicitly ORDER BY (irrespective of whether you did or did not do an ORDER BY in the CREATE ...)
    5. How do you expect to refresh the MV ? Will it always be a COMPLETE Refresh ? Remember that your "5000 employees" filter would likely exclude older employees at the next refresh. If you use some other filter, it should be consistent across all refreshs.
    Hemant K Chitale

  • Materialized View Fast Refresh encounters 2164 BUILD DEFERRED

    I have a materialized view with REFRESH FAST ON DEMAND. The related tables have the required MV Logs and the FAST refresh usually works, but occasional it does not. When it does not there is NO error when DBMS_MVIEW.REFRESH with an F is executed, but the MV is no longer used for QUERY REWRITE. When I run DBMS_MVIEW.EXPLAIN_MVIEW for the MV, I get MSGNO 2164 with MSGTXT 'the materialized view is BUILD DEFERRED'. When I run DBMS_MVIEW.EXPLAIN_REWRITE for a query which used this MV for query rewrite, I get 'QSM-01219: no suitable materialized view found to rewrite this query'.
    I have not been able to find any information on the 2164 message nor have I been able to understand why this happens sometimes and not other times.
    Oracle 11.2.0.2
    Any help in either resolving the error or a method to further research it would be greatly appreciated.
    Thanks!

    I'd like to clarify that the issue I am seeing is NOT the the query will not rewrite. It rewrites perfectly when the MV is in a good state. The problem is that during certain refreshes of the MV a 2164 occurs and I get the message that the query is 'BUILD DEFERRED'. No error comes up during refresh, but when I run DBMS_MVIEW.EXPLAIN_MVIEW and query the MV_CAPABILITIES_TABLE I see the 2164.
    Thanks for everyone's help in trying to get this solved.

  • Materialized view - fast refresh logs

    I understand that there will be a Change Data Capture(CDC) log maintained internally for materialized view fast refresh to happen.
    My question is, will this log get purged once the changes are applied to corresponding materialized view or will it persist with further changes getting appended to it ?
    What would be the size of change log for 150 million records covering 40 base tables ?

    MV log entries are deleted when all registered materialized views that depend on them have refreshed.
    For example: Suppose you have a table T and materialized views A and B that are fast-refresh and depend on the MV log for T.
    On Monday you refresh MV A. The log entries are nto purged because B has not yet incorporated them.
    On Tuesday you refresh MV B. At this point the log entries are purged up to the time on Monday that A was refreshed, because all MVs have processed them.
    On Wednesday you refresh MV A again. At this point the log entries are purged up to the time on Tuesday that A was refreshed. etc.

  • Materialized View fast refresh problems

    I have two databases (A and B).
    In database A, user NICK has a table called COLOUR_MASTER.
    Also in that database, NICK issues the command create materialized view log on colour_master with primary key including new values (and yes, there is a primary key defined for this table)
    In database B, there is a database link called A_LINK, connect to nick identified by password using 'dbA';
    Also in database B, user IAN creates a materialized view CM_MV refresh fast as select * from colour_master@A_LINK
    That statement completes successfully, and there are several million rows in CM_MV when it's done.
    Immediately, IAN issues this command:
    begin
    dbms_mview.refresh('CM_MV');
    end;
    ...and after a slight pause, he gets the error
    ORA-12008: error in materialized view refresh path
    ORA-02068: following sever error from A_LINK
    ORA-03113: end-of-file on communication channel
    Yet a +'select count(*) from colour_master@A_LINK'+ submitted immediately manages to return the correct number of records in database A -so that 3113 is a bit misleading, I think, in that instance A did not crash, the database remains accessible at all times, there are no networking issues (database A and B are both located in the same server room, so this isn't like I'm trying to connect half way round the globe).
    The only thing I can think of is that there's a permissions problem causing this error. That because the MV creation is done via a link, there's no problem in IAN seeing the appropriate objects, but that once refreshes come into play, maybe there is.
    Can anyone shed any light on why I can't do the fast refresh of the view I can happily create, please?

    I'm surprised that no-one has asked you to do the obvious: try doing a select * from colour_master@A_LINK, without that being wrapped up in a create materialized view statment. Just do a plain select * from...
    My bet is that you'll get an ORA_22992 cannot use LOB locators selected from remote tables error. And if you can't do a simple select * from a remote table, I suspect that you can reasonably expect fireworks when you try to create or refresh a materialized view on such a thing!
    Here's a quick test:
    In Database 1:
    =========
    SQL> create table A (col1 varchar2(2), col2 clob);
    Table created.
    SQL> alter table A add constraint A1 primary key (col1);
    Table altered.
    SQL> insert into A values ('AA','This is an entry into a clob column');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> create materialized view log on A with primary key including new values;
    Materialized view log created.In Database 2
    =========
    SQL> connect ims_global/v0yager1@ussd
    Connected.
    SQL> create materialized view B refresh fast as
      2  select * from A@remotedb_link;
    Materialized view created.
    SQL> exec dbms_mview.refresh('B');
    BEGIN dbms_mview.refresh('B'); END;
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-02068: following severe error from REMOTEDB_LINK
    ORA-03113: end-of-file on communication channel
    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
    SQL> drop materialized view B;
    Materialized view dropped.
    SQL> create materialized view B refresh fast as
      2  select col1 from A@ims_link;
    Materialized view created.
    SQL> exec dbms_mview.refresh('B');
    PL/SQL procedure successfully completed.Which seems to replicate your problem rather well, I think.
    I don't know if there are any workarounds for this. I mean, obviously you can miss out the CLOB column in your 'create MV' statement as I just did, but I don't know whether you are even allowed or supposed to be able to create an MV on lob columns and that patch such-and-such will let you do it. Maybe someone else can provide that information.
    But at least you won't have to play Russian roulette with your init.ora parameters!

  • Materialized view fast refresh ...getting ORA-22992: error

    Hi All,
    Oracle version 11.1.0.7
    While creating a materialized view(Fast refresh) on remote tables ... i am getting the ORA-22992: cannot use LOB locators selected from remote tables ... error.
    but the actual scenario is... i am not selecting any of the BLOB/LOB columns from the remote tables. I did n't include them in my materialized query.
    I am able to refresh it complete but couldn't refresh it fast. Here i want to mention other thing... when ever i have records in Mat view log(Base table has a blob cloumns in it)
    i am getting the above error. when no record in the Mat view log(i.e on BLOB base table) .. i can able to refresh it as FAST.
    MV_CAPABILITIES table tells that ...My Mat view is able to refresh it FAST.I don't know howw to approach to solve this issue.could some one tell me the approach..to solve it?
    Here is the sample code ....this is what i have done so fat
    session 1 (REMOTE_ONE)
    I have created synonyms for the remote tables on current schema. That's why i didn't include @DBLINK.
    create table RT_A ( col1_A varchar2(20), col2_A BLOB,COL3_A NUMBER);
    create a table RT_B (COl1_B varchar2(20), col2_B BLOB, COL3_B NUMBER);
    create a table RT_C (COL1_C varchar2(20), col2_C VARCHAR2,COL3_C NUMBER);
    create  MATERIALIZED VIEW LOG ON RT_A 
    WITH  ROWID EXCLUDING NEW VALUES;
    create  MATERIALIZED VIEW LOG ON RT_B
    WITH  ROWID EXCLUDING NEW VALUES;
    create  MATERIALIZED VIEW LOG ON RT_C 
    WITH  ROWID EXCLUDING NEW VALUES;
    grant select on RT_A to CUURRENT_ONE with grant option;
    grant select on RT_B to CUURRENT_ONE with grant option;
    grant select on RT_C to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_A to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_B to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_C to CUURRENT_ONE with grant option;Session 2 (CUURRENT_ONE)
    create materialized view ABC_MV
    BUILD IMMEDIATE REFRESH FORCE ON DEMAND START WITH SYSDATE NEXT SYSDATE+1
    AS
    select A.ROWID AS A_ROWID,
    B.ROWID as B_ROWID,
    C.ROWID AS C_ROWID,
    A.COL1_A,
    B.col1_B,
    c.col1_c
    from RT_A, RT_B,RT_C
    where COL3_A = COL3_B(+)
    and COL3_B = COL3_C(+)Appreciate your help.
    Thanks,
    Mike

    Thanks for the reply
    In that he/she is selecting the LOB column from the remote database(master site).
    I am just referencing the table which has BLOB column in it.I am not referencing any LOB column in my select(Mat view) query...
    is there anything i need to check..?
    Regards,
    Mike

  • ORA-12008:ERR OCCCURS WHEN MATERIALIZED VIEW IS REFRESHED FROM OTHER SCHEMA

    Hi,
    ORA-12008: Error occcurs when materialized view is refreshed from another schema, Following the output of the trace file when error occured.
    /u01/app/oracle/admin/orcl92/bdump/orcl92_j000_23729.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
    System name: Linux
    Node name: newdbserver
    Release: 2.6.9-5.ELsmp
    Version: #1 SMP Wed Jan 5 19:30:39 EST 2005
    Machine: i686
    Instance name: orcl92
    Redo thread mounted by this instance: 1
    Oracle process number: 164
    Unix process pid: 23729, image: oracle@newdbserver (J000)
    *** SERVICE NAME:(SYS$USERS) 2008-05-23 10:30:51.848
    *** SESSION ID:(462.21166) 2008-05-23 10:30:51.848
    *** 2008-05-23 10:30:51.848
    ORA-12012: error on auto execute of job 766
    ORA-12008: error in materialized view refresh path
    ORA-00942: table or view does not exist
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
    ORA-06512: at "SYS.DBMS_IREFRESH", line 683
    ORA-06512: at "SYS.DBMS_REFRESH", line 195
    ORA-06512: at line 1
    Regards,
    Abhishek

    Hi Damorgan,
    As i said, when refresh materialized view from another schema, mentioned error occurs.
    I have also granted accees explicitely still following error occurs.
    ORA-12008: error in materialized view refresh path
    ORA-00942: table or view does not exist
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
    ORA-06512: at "SYS.DBMS_IREFRESH", line 683
    ORA-06512: at "SYS.DBMS_REFRESH", line 195
    ORA-06512: at line 1
    Regards,
    Abhishek
    Message was edited by:
    AbhishekRathod(user559364)

  • Materialized view with refresh frequency of once every day

    DB Version:11g
    If i want to create a Materialized view which should get refreshed once every day, the below code should be fine. Right
    create materialized view mv_empname refresh complete
      start with sysdate
      next sysdate + 1
      as select empname from emp Should i be using TRUNC
    like
    next trunc(sysdate) + 1 for any reason?

    If you dont use TRUNC i guess it will be refreshed every day at the time when it was first refreshed. That is If first time it was refreshed on 3pm then ever day it will be refreshed at 3pm.
    But when you user TRUNC you are removing the time part and it will be set to 00:00:00 meaning 12AM. so the refresh will happen at 12AM ever day.

  • Materialized View not getting refreshed

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE 9.2.0.1.0 Production
    TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 - Production
    I am having a situation here..there a materialized view named mv_empdept,the base table of this MV is located on a remote database.Therefore the MV creation scripti contains a DB link.
    Please find the script below.
    Select Deptno,dept_name,empno,ename,DOB,Job
    from [email protected];
    The refresh mode of this MV is set as FAST,and the refresh cycle is scheduled through Oracle Job.
    The job does get triggerd but from the log we found this error.
    The error message is:ORA-12008: error in materialized view refresh path
    ORA-01461: can bind a LONG value only for insert into a LONG column.
    I even checked at the source Db and found that there is no mismatch as far datatype and datalength is concerned.
    Strangely when i do a manual Complete refresh of the same MV the data does gets populated in mv_empdept snapshot.
    Can anybody explain me the why the data is not getting populated in FAST refresh mode.
    Your help is highly appreciated.
    ---Vineet

    Read the following...
    http://download.oracle.com/docs/cd/B10500_01/server.920/a96567/repmview.htm
    and analyze the restrictions of Fast Refresh in your situation.

  • Matrialized view not refreshing all records from source.

    My materialized view is not refreshing a fixed number of rows i.e 198 every time from source to target.What are the reasons for such behavior. Also what should i do to resolve this discrepancy.
    My mv is a FAST REFRESH ON DEMAND based on ROWID.
    It has a simple sql query select col1,col2,col3 from testschema.mytable@mydb;
    Thanks,
    Sandesh

    Hello Raman & KV,
    Thanks for your Suggestions.
    Unfortunately, I would not be able to implement any of your suggestions because, I m not allowed to change the DTP Settings.
    So, I m working on finding the root cause of this issue and came across a SAP Note - 1506944 - Only one package is always extracted during direct access , which says this is a Program Error.
    Hence, i m checking more with SAP on this and will share their insights once i hear back from them.
    Cheers
    Shiva

  • Regarding Error in Materialized view Fast Refresh

    ORA-12015: cannot create a fast refresh materialized view from a complex query
    CREATE MATERIALIZED VIEW MVCONTENTHISTORY_01
    BUILD IMMEDIATE
    REFRESH FAST
    WITH PRIMARY KEY
    ENABLE QUERY REWRITE
    AS
    SELECT a.DAY, a.contentname,
    SUM
    (CASE
    WHEN (b.subscriptionstartdate) <= (a.DAY)
    AND ((CASE
    WHEN b.subscriptionenddate IS NOT NULL
    THEN (a.DAY)
    ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
    END
    ) <=
    (CASE
    WHEN b.subscriptionenddate IS NOT NULL
    THEN (b.subscriptionenddate)
    ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
    END
    THEN 1
    ELSE 0
    END
    ) COUNT,
    COUNT
    (CASE
    WHEN (b.subscriptionstartdate) <= (a.DAY)
    AND ((CASE
    WHEN b.subscriptionenddate IS NOT NULL
    THEN (a.DAY)
    ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
    END
    ) <=
    (CASE
    WHEN b.subscriptionenddate IS NOT NULL
    THEN (b.subscriptionenddate)
    ELSE TO_DATE ('01/20/1990', 'MM/DD/YYYY')
    END
    THEN 1
    ELSE 0
    END
    ) cnt
    FROM TBLTDATEWISECONTENT a,
    (SELECT TRUNC (a.subscriptionstartdate) subscriptionstartdate,
    TRUNC (a.subscriptionenddate) subscriptionenddate, b.NAME,
    b.contentid
    FROM syntbltcontentsubscrhistory a, syntblmcontent b
    WHERE b.contentid = a.contentid(+)) b
    WHERE a.contentid = b.contentid(+) AND a.DAY = b.subscriptionstartdate(+)
    GROUP BY a.contentname, a.DAY;
    I can't create Materialized view with fast Refresh .
    Kindly provide solution .
    Regards,
    nayana chavda.

    Kindly provide full Oracle version since option vary by release.
    There error message says it is impossible to fast refresh based on a complex query.
    On 10g Oracle provides a package procedure that will tell you why the view cannot be fast refreshed: dbms_mview.explain_mview.
    Otherwise see the Advanced Replication Manual for a list of restrictions.
    10gR2 >>Restrictions for Materialized Views with Subqueries
    The defining query of a materialized view with a subquery is subject to several restrictions to preserve the materialized view's fast refresh capability.
    The following are restrictions for fast refresh materialized views with subqueries:
    Materialized views must be primary key materialized views.
    The master's materialized view log must include certain columns referenced in the subquery. For information about which columns must be included, see "Logging Columns in the Materialized View Log".
    If the subquery is many to many or one to many, join columns that are not part of a primary key must be included in the materialized view log of the master. This restriction does not apply to many to one subqueries.
    The subquery must be a positive subquery. For example, you can use the EXISTS condition, but not the NOT EXISTS condition.
    The subquery must use EXISTS to connect each nested level (IN is not allowed).
    Each table can be in only one EXISTS expression.
    The join expression must use exact match or equality comparisons (that is, equi-joins).
    Each table can be joined only once within the subquery.
    A primary key must exist for each table at each nested level.
    Each nested level can only reference the table in the level above it.
    Subqueries can include AND conditions, but each OR condition can only reference columns contained within one row. Multiple OR conditions within a subquery can be connected with an AND condition.
    All tables referenced in a subquery must reside in the same master site or master materialized view site.
    <<
    HTH -- Mark D Powell --
    Message was edited by: added list of restrictions left off initial post
    mpowel01

Maybe you are looking for

  • ABAP Statement meaning

    Hi, please someone explain me what  the below function will do Cerner value will be 5 or 6 charecter lenght SHIFT cernr RIGHT DELETING TRAILING space.       OVERLAY cernr WITH '000000000000'. Thanks, GAL

  • Supply and Demand Propagation not working in SCM5.0

    Just curious if anyone is using S&OP (Supply and Demand Propagation) in APO? I am using SCM v5.0 and Planning Area 9ASNP01 can not be initialized. OSS 832393 states:  The SNP propagation planning (planning area SNP 9ASNP01, transaction /SAPAPO/SNPSOP

  • Shuffle multiple items before burning to cd?

    A couple of questions here for you guys who are all smarter with iTunes than I am... 1.  I have about 15,000 songs on my computer and I want to burn several completely randomly shuffled cds for long driving days.  Is it possible to shuffle the entire

  • Can't get rid of pop up ads and my pop up is on.

    When I first got my Mac I had no trouble going to sites and no pop up ads. My pop up blocker is on and I can't go to sites without pop up ads from other places showing me where to get items from or advertising and a little place pops up when it is un

  • Dreamweaver CC 2014 - Mac OSX 10.8.5 - Il programma gira molto lentamente

    Dreamweaver CC 2014 - Mac OSX 10.8.5 - Il programma gira molto lentamente, tale da non riuscire a lavorare. Prove già eseguite: - 1) Disinstallato e reinstallato il programma, ma il problema persiste. - 2) Disinstallato per sicurezza Dreamweaver CC (