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

Similar Messages

  • Issue with materialized view and fast refresh between Oracle 10g and 11g

    Hi all,
    I've hit a problem when trying to create a fast-refreshable materialized view.
    I've got two databases, one 10.2.0.10, another 11.2.0.1.0, running on 32-bit Windows. Both are enterprise edition, and I'm trying to pull data from the 10g one into the 11g one. I can happily query across the database link from 11g to 10g, and can use complete refresh with no problem except the time it takes.
    On the 10g side, I've got tables with primary keys and m.v. logs created, the logs being of this form ...
    CREATE MATERIALIZED VIEW LOG ON table WITH PRIMARY KEY INCLUDING NEW VALUES
    On the 11g side, when I try to create an m.v. against that ...
    CREATE MATERIALIZED VIEW mv_table REFRESH FAST WITH PRIMARY KEY AS SELECT col1, col2 FROM table@dblink;
    ... I get an ORA-12028 error (materialized view type is not supported by master site).
    After running the EXPLAIN_MVIEW procedure it shows this;
    REFRESH_FAST_AFTER_INSERT not supported for this type mv by Oracle version at master site
    A colleague has managed to build a fast-refresh m.v. from the same source database, but pulling to a different one than I'm using; his target is also 10g, like the (common) source, so I've no idea why I'm getting the 'not supported' message whilst he isn't.
    I've been able, on previous projects, to do exactly what I'm trying to achieve but on those someone with more knowledge than me has configured the database!
    I'm now stumped. I'm also no DBA but despite that it's been left to me to install the new 11g database on the 32-bit Windows server from scratch, so there are probably a couple of things I'm missing. It's probably something really obvious but I don't really know where to look now.
    If anyone can give me any pointers at all, I'd be really grateful. This question is also duplicated in the Replication forum but hasn't had any replies as yet, so I'm reproducing it here in hope!
    Thanks in advance,
    Steve

    Hi Steve,
    You should have a look at metalink, Doc ID 1059547.1
    If that does not help, there may be something else in Mater note ID 1353040.1
    Best regards
    Peter

  • 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.

  • Refresh materialized view on fast refresh

    Hi,
    I want to create a fast refresh on a materialized view but i kept getting ORA-12015: cannot create a fast refresh materialized view from a complex query. When I did a complete refresh on the materialzed view, it completed. I have create a materialized view log for the table. In my materialized view script, I have included a user defined function. Does db version 10g have the capability to do a fast refresh?
    Thanks

    What is the query you are using for the MV?
    The error message says it all... "cannot create a fast refresh materialized view from a complex query"
    If your query is complex then you will have to perform complete refreshes.
    One way around can be to fast refresh all tables in the query then create a view on them based on the 'complex' query. Admittedly this is only a workaround in certain scenarios.
    Check out the documentation...
    http://68.142.116.70/docs/cd/B19306_01/server.102/b14226/repmview.htm#sthref422

  • Enabling materialized view for fast refresh method

    In AWM when i select refresh method as FAST and enable the materialized view, am getting the below error:
    "Refresh method fast requires materialized view logs and a previously run complete refresh of the cube mv". i need this Fast refresh of a cube materialized view, so that it performs an incremental refresh and re-aggregation of only changed rows in the source table.
    can anyone help me on this??

    If you want the cube to hold data even after it has been deleted from the relational table, then you should disable the MV on the cube.
    Synchronization with the source table is determined by the default "cube script".
    <li>CLEAR, LOAD, SOLVE : This will synchronize your cube with the source table. It is a requirement for MVs.
    <li>LOAD, SOLVE: This will allow your cube to contain data even after it has been removed from the source table. It sounds like you want this.
    Cube builds can be "incremental" in one of two ways.
    (1) You can have an "incremental LOAD" if the source table contains only the changed rows or if you use MV "FAST" or "PCT" refresh. Since you can't use MVs, you would need a source table with only the changed rows.
    (2) You will have an "incremental SOLVE" (a.k.a. "incremental aggregation") if there is no "CLEAR VALUES" or "CLEAR AGGREGATES" step and various other conditions hold.
    To force a "complete LOAD" with an "incremental SOLVE" you should have all rows in your source table and run the following build script.
    LOAD, SOLVE You could also run "CLEAR LEAVES, LOAD, SOLVE" to synchronize the cube with the table.
    To force an "incremental LOAD" with a "complete SOLVE" you make the source table contains only the changed rows and the run the following:
    CLEAR AGGREGATES, LOAD, SOLVEor
    LOAD, CLEAR AGGREGATES, SOLVEFinally, if you want both LOAD and SOLVE to be incremental you make the source table contains only the changed rows and the run the following:
    LOAD, SOLVE

  • 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 views  not updating

    I'm having trouble with getting a materialized view with fast refresh to update. I'm working between two schemas and have the global query rewrite privilege for both users. I've run the catrep.sql script to make sure it had been run and find that it has a lot of packages that don't compile, which I guess is expected as I'm not using Advanced Replication. I think the problem is that I can't get the dbms_snapshot package to compile so can't even update the view manually. Is there another script I need to run to make the materialized views work? Some other privilege or variable?
    I've granted permissions on tables, views, materialized views, triggers, and snapshots to both users.
    The log does get entries but never sends them to the views.
    I have a base table and a log on the table in schema 1.
    I have a materialized view in schema 2:
    create materialized view log on schema1.document
    tablespace app_mview
    with primary key
    ( list columns needed);
    create materialized view schema2.doc_mv
    pctfree 0
    tablespace app_mview
    storage (initial 128k next 128k pctincrease 0)
    refresh fast
    start with sysdate
    next sysdate + 1/1440
    as select * from schema1.document
    Does anyone know where my problem might be?
    thanks for any help

    I have temporary parameters, not in itit.ora but echoing the job_queue_processes is 10, job_queue_interval is 60.
    a sho err returns no errors.
    earlier I did not get anything new in dba_errors when trying to compile. Since I've rerun the catrep.sql I'm getting pls-00201 - identifier must be declared for a lot of dbms_snap, sys.dbms_alert, dbms_reputil2 etc. (package, package body, and trigger types) That is why I think there must be another script that should be run that I don't know about.
    I can't do a full refresh because the dbms_snapshot package will not compile. I believe it's possible that both full and fast will work once I get the dbms_snapshot package working.
    thanks for your help
    pat

  • Materiazed view with fast refresh

    Hi All,
    I want to create a Materialized view with fast refresh.
    I think for fast refresh we need to set up a materialized view log first before the MV gets created.
    Can someone please provide the steps and the syntax to do this?
    I am new to MV creation so appreciate any help in this regard.
    Thanks.
    AS

    http://www.morganslibrary.org/library.html
    Look up Materialized View Log and Materialized View ... both on the same page ... build the demo MV and you can modify the code to build any others you wish.

  • Query against materialized view awful after refresh of Mview

    We have a materialized view defined to refresh complete daily at 5am. YOu can run queries against the MV alone or joining it to other tables. Results come back in 2 or 3 seconds. Once the MView refreshes at 5am - those same queries now take 15 minutes or even more sometimes to complete. WHY IS THIS HAPPENING?? Help anyone?

    okay this is better... sorry...
    this is the GOOD EXPLAIN PLAN:
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                      
    | Id  | Operation                         |  Name             | Rows  | Bytes | Cost  |                                                                                                                                                                                                
    |   0 | SELECT STATEMENT                  |                   |     1 |   127 |  1665 |                                                                                                                                                                                                
    |   1 |  SORT AGGREGATE                   |                   |     1 |   127 |       |                                                                                                                                                                                                
    |   2 |   NESTED LOOPS                    |                   |     1 |   127 |  1665 |                                                                                                                                                                                                
    |   3 |    NESTED LOOPS                   |                   |     1 |   113 |  1664 |                                                                                                                                                                                                
    |   4 |     NESTED LOOPS                  |                   |     1 |    99 |  1663 |                                                                                                                                                                                                
    |   5 |      NESTED LOOPS                 |                   |     1 |    88 |  1662 |                                                                                                                                                                                                
    |*  6 |       HASH JOIN ANTI              |                   |     1 |    70 |  1661 |                                                                                                                                                                                                
    |*  7 |        TABLE ACCESS BY INDEX ROWID| CONTACT           |  3815 |   201K|  1534 |                                                                                                                                                                                                
    |   8 |         AND-EQUAL                 |                   |       |       |       |                                                                                                                                                                                                
    |*  9 |          INDEX RANGE SCAN         | IDX_CNT__C_STATE  |       |       |       |                                                                                                                                                                                                
    |* 10 |          INDEX RANGE SCAN         | IDX_CNT__STATUS   |       |       |       |                                                                                                                                                                                                
    |  11 |        INDEX FAST FULL SCAN       | PK_RPP            | 69277 |  1082K|   120 |                                                                                                                                                                                                
    |* 12 |       TABLE ACCESS BY INDEX ROWID | REP_PROFILE       |     1 |    18 |     1 |                                                                                                                                                                                                
    |* 13 |        INDEX UNIQUE SCAN          | PK_C19            |     1 |       |       |                                                                                                                                                                                                
    |* 14 |      INDEX UNIQUE SCAN            | PK_B01            |     1 |    11 |       |                                                                                                                                                                                                
    |* 15 |     INDEX UNIQUE SCAN             | PK_B02            |     1 |    14 |       |                                                                                                                                                                                                
    |* 16 |    INDEX UNIQUE SCAN              | PK_RCN            |     1 |    14 |       |                                                                                                                                                                                                
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                    
       6 - access("B"."CONTACT_ID"="RPP"."PARTNERSHIP_ID")                                                                                                                                                                                                                                 
       7 - filter("B"."C_STATE"='GA' AND "B"."C_LAST"<>'Name Unknown' AND                                                                                                                                                                                                                  
                  "B"."STATUS"='Confirmed')                                                                                                                                                                                                                                                
       9 - access("B"."C_STATE"='GA')                                                                                                                                                                                                                                                      
      10 - access("B"."STATUS"='Confirmed')                                                                                                                                                                                                                                                
      12 - filter("C19"."TERR1"='46')                                                                                                                                                                                                                                                      
      13 - access("B"."CONTACT_ID"="C19"."CONTACT_ID")                                                                                                                                                                                                                                     
      14 - access("B"."FIRM_ID"="B01"."FIRM_ID")                                                                                                                                                                                                                                           
      15 - access("B"."OFFICE_ID"="B02"."OFFICE_ID")                                                                                                                                                                                                                                       
      16 - access("B"."CONTACT_ID"="RCN"."CONTACT_ID")                                                                                                                                                                                                                                     
    Note: cpu costing is off                                                                                                                                                                                                                                                               
    38 rows selected.

  • 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 creation with REFRESH FAST

    Hello ,
    Please see below case,
    TABLE A1(partitioned range+list)
    COLUMN C1  -- Primary key
    COLUMN C2  -- NUMBER
    TABLE D1
    COLUMN C1 -- PRIMARY KEY
    created MV log as below
    CREATE MATERIALIzED VIEW LOG ON A1 WITH ROWID,PRIMARY KEY INCLUDING NEW VALUES;
    CREATE MATERIALIzED VIEW LOG ON D1 WITH ROWID,PRIMARY KEY INCLUDING NEW VALUES;
    Trying to create MV like below:
    CREATE MATERILIZED VIEW mv1test
                                    REFRESH FAST ON COMMIT
    AS
    Select
    FROM A1,
                            D1
                    WHERE A1.C1 = D1.CI
    AND A1.C2 IS NOT NULL;
    It gives below error message:
    ORA-12052: cannot fast refresh materialized view schema.mv1test
    12052. 00000 -  "cannot fast refresh materialized view %s.%s"
    *Cause:    Either ROWIDs of certain tables were missing in the definition or
               the inner table of an outer join did not have UNIQUE constraints on
               join columns.
    *Action:   Specify the FORCE or COMPLETE option. If this error is got
               during creation, the materialized view definition may have be
               changed. Refer to the documentation on materialized views.
    However ,as discussed in earlier thread i checked all general restrictions of the 'Refresh fast' approach for join.
    Restrictions on Fast Refresh on Materialized Views with Joins Only
    Defining queries for materialized views with joins only and no aggregates have the following restrictions on fast refresh:
    1) They cannot have GROUPBY clauses or aggregates.
    2) Rowids of all the tables in the FROM list must appear in the SELECT list of the query.
    3)Materialized view logs must exist with rowids for all the base tables in the FROM list of the query.
    4)You cannot create a fast refreshable materialized view from multiple tables with simple joins that include an object type column in the SELECTstatement.
    As per above restrictions ,
    1) Group by clause is not present
    2)i do not understand 2nd point , i have added a1.rowid  and d1.rowid in  select statement of MV, but got same error.
    3) observed same as 2nd point.
    4)we have CLOB column in select list. Tried removing this column but got same error.
    Please do let me know any workaround on this.
    Thanks in advanced ..
    PM

    Basic Materialized Views show how to analyse MVs using dbms_mview. I'm not sure about creating MVs on partitioned tables, that partition maintenance might cause problems

  • 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 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 - parameter and refresh

    Hi,
    We are creating a Materialized view that has 2 rows for a CCID, one for this year and one for previous year with balances in 12 buckets.
    We have 2 questions:
    1. Can a materialized view be created with a parameter? or it can only take hard coded values?
    2. Can we refresh a part of materialized view, lets say we want to refresh the balances only for this year?
    Thanks

    user12182208 wrote:
    Hi,
    We are creating a Materialized view that has 2 rows for a CCID, one for this year and one for previous year with balances in 12 buckets.
    We have 2 questions:
    1. Can a materialized view be created with a parameter? or it can only take hard coded values? Typically, you want a materialized view to contain a complete set of aggregate data ... so, no, parameters don't really make sense (also, the results are pre-computed unlike a regular VIEW which is just a stored query. With a MV the data is actually computed on creation unless you defer it, and takes up physical storage).
    >
    2. Can we refresh a part of materialized view, lets say we want to refresh the balances only for this year?
    You can (depending on your Oracle Version and complexity of your materialized view) create a materialized view that does fast refreshes. If for some reason it was pertinent for you to achieve what you've asked, you could make 2 MV's and then a view that does a UNION ALL of them (the MV's would not contain overlaps), then you would just refresh the 1 MV, seems odd to me to want to do this though.
    Thanks

  • How does materialized view work when refresh the view vs create the view?

    I am using a materialized view, and I cant set it to fast refresh because some of the tables are from remote database which does not have materialized view log.
    When I create the materialized view, it took like 20 30 seconds. however when I was trying to refresh it. It took more than 2 3 hours. and total number of records are only around 460,000.
    I understand that when the view refreshes, it would take extra step like purge the table however I am not sure why it made so much difference in execution time perspective...
    Does the dbms_mview.refresh('MY_MATVIEW', 'C', atomic_refresh=>false) do the same exact insert as when I created the view?
    Could anyone please let me know how would this happen? Thanks,
    Code looks like as following
    create materialized view MY_MV1
    refresh force on demand
    start with to_date('20-02-2013 22:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate)+1+22/24
    as
    ( SELECT Nvl(Cr.Sol_Chng_Num, ' ') AS Change_Request_Nbr,
           Nvl(Sr.Sr_Num, ' ') AS Service_Request_Nbr,
           Nvl(Sr.w_Org_Id, 0) AS Org_Id,
           Fcr.rowid,
           Cr.rowid,
           Bsr.rowid,
           Sr.rowid,
           SYSDATE
      FROM [email protected] Fcr
    INNER JOIN [email protected] Cr
        ON Fcr.w_Sol_Chng_Id = Cr.w_Sol_Chng_Id
    INNER JOIN [email protected] Bsr
        ON Fcr.w_Sol_Chng_Id = Bsr.w_Sol_Chng_Id
    INNER JOIN [email protected] Sr
        ON Sr.w_Srv_Rec_Id = Bsr.w_Srv_Rec_Id
    WHERE Sr.Sr_Num !='NS'
    );I have tried to use dbms_mview.refresh('MY_MATVIEW', 'C', atomic_refresh=>false) but it still took 141 mins to run... vs 159 mins without atomic_refresh=>false
    Edited by: 986006 on Feb 20, 2013 2:15 PM

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION)
    >
    I am using a materialized view, and I cant set it to fast refresh because some of the tables are from remote database which does not have materialized view log.
    When I create the materialized view, it took like 20 30 seconds. however when I was trying to refresh it. It took more than 2 3 hours. and total number of records are only around 460,000.
    I understand that when the view refreshes, it would take extra step like purge the table however I am not sure why it made so much difference in execution time perspective...
    Does the dbms_mview.refresh('MY_MATVIEW', 'C', atomic_refresh=>false) do the same exact insert as when I created the view?
    >
    What Oracle version are you using? The 'atomic_refresh' parameter default was changed to TRUE starting with 10g.
    See the PL/SQL Packages and Types doc
    >
    atomic_refresh
    If this parameter is set to true, then the list of materialized views is refreshed in a single transaction. All of the refreshed materialized views are updated to a single point in time. If the refresh fails for any of the materialized views, none of the materialized views are updated.
    If this parameter is set to false, then each of the materialized views is refreshed in a separate transaction.
    >
    What that means is that if the value is TRUE Oracle uses a DELETE to remove the existing rows. If the value is FALSE then Oracle uses TRUNCATE.
    If you really are using the FALSE setting you should not be seeing that much of a time difference between creating the MV and a complete refresh so something else must be going on.

Maybe you are looking for

  • Problem in schema tranformation

    Hi, I am trying to tranform one object to another object by using transform activity. When i test the .xsl file by giving the input data in the jdeveloper transformation is successful. But when i deploy this object and test through bpel console, tran

  • Xperia Z3v Head Phone Jack Cover

    Just curious if any one of you had dipped your Xperia Z3v in water....On sonymobile.com it says that make sure all the ports are closed, but the phone did not come with a head phone jack cover.  Does that mean it is already waterproof?  I examined al

  • When using my power adapter, the light is green for a two seconds and turns red.

    When using the power adapter for my MacBook 2.1, the little light on the connector is green for 2 or 3 seconds and then turns red.  I bought a new adapter, but it is the same thing. It looks like the computer is charging.  What's wrong with it.

  • Best after market effects generators for text and graphics?

    Someone posted a link of many different companies that have after market effects you can download to FCE. Does anyone have that link AND what after market programs do you recommend? All i have is LiveType that came with Final Cut Express, I need to a

  • Split only ONE footnote?

    Hi, I have a long document with a bunch of footnotes. All the footnotes are fairly short except for one which I would like to split to the next page. Is there any way to split just ONE footnote? I have tried the "split footnotes" option but it splits