Dimension updates in Analytic workspace:Materialized views?

We are using the 10g version of Oracle OLAP. We have 1 materialized view joining with our custom table and forming 1 source view per dimension. We load the cube programatically by refresh the dimension materialized views, followed by loading fact data to views against cube and then the actual workspace and cube creation..
Question is :
1) Do dimensions get loaded to analytic workspace only when the analytic workspace is created (programatically or maintain dimension via AW)?
2) Assume we do not create the analytic workspace programatically or do not do a maintain dimension. In this case willl the dimensions in the analytic workspace get refreshed any time the data in source tables in the materialized view or custom table used in dimension source view change?
Please advise.
Thanks,
Sudip

If the data source changes for OLAP 10g then you must maintain the AW/ dimensions/cubes. There is no ability to check if anything in the source has changed.
If using 11g, then you can use the MV refresh capabilities to maintain your AW (if your model conforms)...MV refresh features detects changes in the source tables.
Hope I understood your question correctly.

Similar Messages

  • Refresh/Update data in a materialized view

    Hi,
    I have question about the data in a materialized view and how it is refreshed. My mat view has all my dimension-ids and my (for my specialize needs) aggregated measures from my fact table. I used the mat view wizard to create my view - which works perfectly. But now I wonder if I have to create some sort of mapping(?) or some sort of trigger to refresh the data in the mat view. Or is the data automatically refreshed when I start my fact table mappings. I use OWB 11gR2
    thx

    MVs have properties for refresh - you an refresh based on schedules or when dependent data is committed or manually.
    Cheers
    David

  • UPDATING the query in materialized view

    Hi,
    i have a little doubt in Materialized view. i created a materialized view and log with the following query,
    create table test_mv (a number ,b number )
    alter table test_mv add constraint t_pk primary key ( a );
    insert into test_mv values (1,2);
    insert into test_mv values(2,2);
    insert into test_mv values(3,2);
    insert into test_mv values(4,2);
    insert into test_mv values(5,2);
    commit;
    CREATE MATERIALIZED VIEW LOG ON test_mv
    WITH SEQUENCE, ROWID
    *(a,b)*
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW product_sales_mv
    ENABLE QUERY REWRITE
    AS SELECT  b  from test_mv;
    Now i want to update the query in the MV as 'Select a from test_mv' . for that i tried with
    *'ALTER MATERIALIZED VIEW product_sales_mv AS SELECT a from test_mv;'*
    But it throwing error,
    Error starting at line 5 in command:
    alter  MATERIALIZED VIEW product_sales_mv   AS SELECT  b  from test_mv
    Error report:
    SQL Error: ORA-00933: SQL command not properly ended
    +00933. 00000 - "SQL command not properly ended"+
    *Cause:+   
    *Action:+
    i guess i am doing wrong. kindly help me here. i want to update it without drop and recreate.
    thanks,
    Jeevanand.Ke

    Hi Jeeva,
    No. you cannot add or drop columns to the materialized view using the ALTER Statement.
    To Change the Structure of the view , drop and re-create the materialized view.
    To Alter a materialized view log, You can use the ALTER MATERIALIZED VIEW LOG. By this,
    You can add new columns to a materialized view log.
    ALTER MATERIALIZED VIEW LOG ON sggi_mrps.emp ADD(deptno);Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 24, 2012 2:11 AM

  • Update sequence wrong in Materialized view when using refresh group

    Hi,
    I made a trigger (for each row) on a materialized view(replication data from a master table in in a different database), which is refreshed by a refresh group (exec dbms_refresh.refresh('"...). However, the update order/sequence is important and must be handled (by the trigger) in the same order how the updates where done in the master table. Unfortunately the updates in the materialized view are NOT in the same order. The trigger is fired in a wrong order.
    I am using database version 10.2.0
    Does anybody reconize this problem, Is there a solution for this problem ( with keeping the refresh group mechanisme)?
    Thanks
    Regards
    Jurn

    rownum is determined as the row is output, so "order by rownum" does literally nothing.
    http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm

  • Updating base table with Materialized View's data

    Hi,
    In order to update base table with MVs data, I am trying real time data transfer between two databases. One is Oracle 8i and other is Oracle 9i. I have created an updatable MV in 9i on a base table using database link. The base table is in 8i. Materialized View log is created in 8i on base table. MV has to be associated to some replication group, but I am not able to create replication group in 9i to which MV has to be associated. The required packages are not installed.
    Replication packages are to be used to create replication group are :
    /*Create Materialized View replication group*/
    BEGIN
    DBMS_REPCAT.CREATE_MVIEW_REPGROUP (
    gname => 'TEST_MV_GRP',
    master => 'TEST_DATA_LINK',
    propagation_mode => 'ASYNCHRONOUS');
    END;
    But above block is giving error.
    Can anyone suggest how to resolve this, or are there any other approaches (by not using replication packages) to update base table with MVs data ?
    Thanks,
    Shailesh

    Yes, I created link between two databases and was able to update tables on 8i from 9i database using that link.
    The error I am getting while creating replication group is :
    ORA-06550
    PLS-00201 : identifier 'SYS.DBMS_REPCAT_UTL2@'TEST_DATA_LINK' must be declared
    ORA-06550
    PLS-00201 : identifier 'SYS.DBMS_REPCAT_UNTRUSTED@'TEST_DATA_LINK' must be declared
    ORA-06512 : at "SYS.DBMS_REPCAT_UTL", line 2394
    ORA-06512 : at "SYS.DBMS_REPCAT_SNA_UTL", line 1699
    ORA-06512 : at "SYS.DBMS_REPCAT_SNA", line 64
    ORA-06512 : at "SYS.DBMS_REPCAT", line 1262
    Is there any other approach which can be used to update base table with MVs data instead of using replication packages ?
    Thanks,
    Shailesh

  • Delete dimension/cube in Analytic Workspace

    Hello, I've created some dimensions and cubes in an analytic workspace using DBMS_AW package. But, How can I delete these objects using a similar methodology? I have not found any procedure like CREATE_AWDIMENSION/CREATE_AWCUBE that helps me to delete the object.
    Thanks by your help.

    In 9.2x code stream, having it not in cwm2/all_olap2_dimensions means it will be invisible/unaccessible to the OLAP API but, as you point out, it still exists in the AW, and as such, it still exists in all_olap2_aw_dimensions.
    The early comment was a way to potentially "work around" the inability of no automation to "fully" delete it, by suggesting a way to "partially" delete it so as to "hide" the dimension from the OLAP API, without actually deleting it (or any of it's storage, obviously) from the AW.

  • On commit fast refreshable materialized view does not update

    ... but instead it deletes and inserts. And I would like it to perform an update, so we can add a database trigger to call a webservice. But it's crucial that we call the "update webservice" when it updates.
    This is an Oracle 10.2.0.4 database.
    Output of my problem-reproducing-case:
    First creation of a small instrumentation setup:
    SQL> create table logtable
      2  ( id   number
      3  , time timestamp
      4  , text varchar2(100)
      5  )
      6  /
    Tabel is aangemaakt.
    SQL> create sequence log_seq cache 100
      2  /
    Reeks is aangemaakt.
    SQL> create procedure add_log_message (p_text in varchar2)
      2  is
      3    pragma autonomous_transaction;
      4  begin
      5    insert into logtable
      6    values (log_seq.nextval,systimestamp,p_text);
      7    commit;
      8  end;
      9  /
    Procedure is aangemaakt.Two tables with full blown materialized view logs defined on them:
    SQL> create table t1 (id,ean)
      2  as
      3   select level
      4        , to_char(trunc(dbms_random.value(0,999999999999999999)))
      5     from dual
      6  connect by level <= 10
      7  /
    Tabel is aangemaakt.
    SQL> alter table t1 add primary key (id)
      2  /
    Tabel is gewijzigd.
    SQL> create materialized view log on t1 with sequence, rowid (id,ean) including new values
      2  /
    Gematerialiseerde viewlog is aangemaakt.
    SQL> create table t2 (id,t1_id,value)
      2  as
      3   select level
      4        , level * 2
      5        , trunc(dbms_random.value(1,100))
      6     from dual
      7  connect by level <= 5
      8  /
    Tabel is aangemaakt.
    SQL> alter table t2 add primary key (id)
      2  /
    Tabel is gewijzigd.
    SQL> alter table t2 add foreign key (t1_id) references t1(id)
      2  /
    Tabel is gewijzigd.
    SQL> create materialized view log on t2 with sequence, rowid (id,t1_id,value) including new values
      2  /
    Gematerialiseerde viewlog is aangemaakt.And the materialized view itself, containing an outer join. And on that materialized view there is a trigger that logs the action performed (I, U or D):
    SQL> create materialized view mv refresh fast on commit
      2  as
      3  select t1.rowid t1_rowid
      4       , t2.rowid t2_rowid
      5       , t1.id    t1_id
      6       , t1.ean   ean
      7       , t2.id    t2_id
      8       , t2.value value
      9    from t1
    10       , t2
    11   where t1.id = t2.t1_id (+)
    12     and t1.ean is not null
    13  /
    Gematerialiseerde view is aangemaakt.
    SQL> create trigger mv_trg_ariud
      2  after insert or update or delete on mv
      3  for each row
      4  begin
      5    add_log_message
      6    ( case
      7        when inserting then 'I'
      8        when updating then 'U'
      9        when deleting then 'D'
    10      end
    11    );
    12  end;
    13  /
    Trigger is aangemaakt.
    SQL> select * from mv
      2  /
    T1_ROWID           T2_ROWID                T1_ID EAN                                           T2_ID      VALUE
    AAFwMeAChAABamIAAA                             1 360432237186591962
    AAFwMeAChAABamIAAB AAFwMhAChAABamaAAA          2 706465424496730795                                1         77
    AAFwMeAChAABamIAAC                             3 678961199378791568
    AAFwMeAChAABamIAAD AAFwMhAChAABamaAAB          4 351418443524585979                                2         35
    AAFwMeAChAABamIAAE                             5 610374519804201714
    AAFwMeAChAABamIAAF AAFwMhAChAABamaAAC          6 798782716740397566                                3         33
    AAFwMeAChAABamIAAG                             7 909989471290455410
    AAFwMeAChAABamIAAH AAFwMhAChAABamaAAD          8 670698835550268126                                4         69
    AAFwMeAChAABamIAAI                             9 746290195605805530
    AAFwMeAChAABamIAAJ AAFwMhAChAABamaAAE         10 157491298211132413                                5         82
    10 rijen zijn geselecteerd.Now we add a new t1 row, which leads to an extra row in the mv on commit time:
    SQL> insert into t1 values (11, '999999999999999999')
      2  /
    1 rij is aangemaakt.
    SQL> commit
      2  /
    Commit is voltooid.
    SQL> select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
      2    from logtable
      3   order by id
      4  /
    LOG
    I         11:39:47.817225
    1 rij is geselecteerd.
    SQL> select * from mv where ean = '999999999999999999'
      2  /
    T1_ROWID           T2_ROWID                T1_ID EAN                                           T2_ID      VALUE
    AAFwMeAChAABamJAAA                            11 999999999999999999
    1 rij is geselecteerd.As expected. Now insert a record in t2, which should lead to an update of the materialized view:
    SQL> insert into t2 values (11,11,1)
      2  /
    1 rij is aangemaakt.
    SQL> commit
      2  /
    Commit is voltooid.
    SQL> select * from mv where ean = '999999999999999999'
      2  /
    T1_ROWID           T2_ROWID                T1_ID EAN                                           T2_ID      VALUE
    AAFwMeAChAABamJAAA AAFwMhAChAABambAAA         11 999999999999999999                               11          1
    1 rij is geselecteerd.
    SQL> select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
      2    from logtable
      3   order by id
      4  /
    LOG
    I         11:39:47.817225
    D         11:39:47.992824
    I         11:39:48.015072
    3 rijen zijn geselecteerd.But it doesn't: apparently it has inserted a row and deleted a row. Let's do a normal update:
    SQL> update t2 set value = 2 where id = 11
      2  /
    1 rij is bijgewerkt.
    SQL> commit
      2  /
    Commit is voltooid.
    SQL> select * from mv where ean = '999999999999999999'
      2  /
    T1_ROWID           T2_ROWID                T1_ID EAN                                           T2_ID      VALUE
    AAFwMeAChAABamJAAA AAFwMhAChAABambAAA         11 999999999999999999                               11          2
    1 rij is geselecteerd.
    SQL> select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
      2    from logtable
      3   order by id
      4  /
    LOG
    I         11:39:47.817225
    D         11:39:47.992824
    I         11:39:48.015072
    D         11:39:48.142621
    I         11:39:48.168553
    5 rijen zijn geselecteerd.And again: a delete and an insert.
    Does anybody know if I can change this behaviour and let the mv perform an update?
    In another materialized view (not shown here) containing aggregates, I've seen that it performs an update. But using this "join" mv, it does not.
    Here is the script, if you want to try it on your own database:
    create table logtable
    ( id   number
    , time timestamp
    , text varchar2(100)
    create sequence log_seq cache 100
    create procedure add_log_message (p_text in varchar2)
    is
      pragma autonomous_transaction;
    begin
      insert into logtable
      values (log_seq.nextval,systimestamp,p_text);
      commit;
    end;
    create table t1 (id,ean)
    as
    select level
          , to_char(trunc(dbms_random.value(0,999999999999999999)))
       from dual
    connect by level <= 10
    alter table t1 add primary key (id)
    create materialized view log on t1 with sequence, rowid (id,ean) including new values
    create table t2 (id,t1_id,value)
    as
    select level
          , level * 2
          , trunc(dbms_random.value(1,100))
       from dual
    connect by level <= 5
    alter table t2 add primary key (id)
    alter table t2 add foreign key (t1_id) references t1(id)
    create materialized view log on t2 with sequence, rowid (id,t1_id,value) including new values
    create materialized view mv refresh fast on commit
    as
    select t1.rowid t1_rowid
         , t2.rowid t2_rowid
         , t1.id    t1_id
         , t1.ean   ean
         , t2.id    t2_id
         , t2.value value
      from t1
         , t2
    where t1.id = t2.t1_id (+)
       and t1.ean is not null
    create trigger mv_trg_ariud
    after insert or update or delete on mv
    for each row
    begin
      add_log_message
      ( case
          when inserting then 'I'
          when updating then 'U'
          when deleting then 'D'
        end
    end;
    select * from mv
    insert into t1 values (11, '999999999999999999')
    commit
    select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
      from logtable
    order by id
    select * from mv where ean = '999999999999999999'
    insert into t2 values (11,11,1)
    commit
    select * from mv where ean = '999999999999999999'
    select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
      from logtable
    order by id
    update t2 set value = 2 where id = 11
    commit
    select * from mv where ean = '999999999999999999'
    select rpad(text,10) || to_char(time,'hh24:mi:ss.ff6') log
      from logtable
    order by id
    set echo off
    drop materialized view mv
    drop table t2 purge
    drop table t1 purge
    drop procedure add_log_message
    drop sequence log_seq
    drop table logtable purge
    /Regards,
    Rob.
    Edited by: Rob van Wijk on 7-mrt-2009 9:49
    bump

    Rob,
    here's what Tom says about this:
    seems dangerous as there is nothing stopping Oracle from performing an "update" of a materialized
    view as a DELETE+INSERT.  For you see, the internals of how materialized views are maintained are
    "internal" and subject to change (so even if documented - so what, you cannot control the "how" of
    materialized view refreshes)
    ...It is from 2006 though ...things might have changed ;)

  • Time taken to Refresh a Materialized View

    Hi,
    Can we somehow estimate the approximate time it takes to Fast Refresh a particular Materialized View?
    In my case it is REFRESH FAST ON DEMAND and it contains close to 65 Million Records. On a daily basis 40K records are updated/inserted in the Materialized View. Also MV Logs are created on the Master Tables.
    The query of the MV is a join between a Dimension and Fact Table of a Datawarehouse. Each Master Table contains close to 70 million records.
    Could you please let me know?
    Thanks, Ketan

    Hi Jignesh,
    Thanks for the reply.
    Actually what I would like to know is can we somehow estimate/forecast the Refresh Time before actually refreshing the MV.
    Currently, in my case I am testing in a Non-Production Environment where the two MV logs contain 65K and just 70 records respectively. The Records finally Inserted/Updated from the MV is just 50. The time to refresh is about 7 minutes.
    However, in the Production Environment, I am expecting close to 25-30K Inserts/Updates from the MV. So, I would like to know if we could PREDICT the approximate time required to Refresh a far larger dataset?
    For example, to refresh close to 100K records in the View Logs will it take a far greater time or just some additional time? Is the Refresh rate directly dependent on the Number of Records to be refreshed or it takes a standard time to Refresh irrespective of the No. of Records?
    Would appreciate your inputs on this.
    Thanks, Ketan

  • Reg  ora-12034 materialized view log on younger than last refresh

    Hi,
    when i update my base table materialized view log shows the updated rows
    but when i refresh materialized view it wont show updated rows in materialized view and also there is no rows in materialzed log
    it shows error ora-12034: materialized view log on younger than last refresh
    cheers,

    FIX
    A complete refresh is required before the next fast refresh.
    Please run the process "Refresh Materialized Views"

  • Query rewrites with Nested materialized views with different aggregations

    Platform used : Oracle 11g.
    Here is a simple fact table (with measures m1,m2) and dimensions (a) Location (b) Calendar and (c) Product. The business problem is that aggregation operator for measure m1,m2 are different along location dimension and Calendar dimension. The intention is to preaggregate the measures for a product along the calendar dimension and Location dimension and store it as materialized views.
    The direct option is to define a materialized view with Inline queries (Because of the different aggrergation operator, it is not possible to write a query without Inline query). http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28313/qradv.htm#BABEAJBF documents the limitations that it works only for 'Text match' and 'Equivalent queries' and that is too limiting.
    So decided to have nested materialized view, with first view having just joins(my_dim_mvw_joins), the second view having aggregations along Calendar dimension (my_dim_mvw_calendar) and third view having aggregations along the Location dimension(my_dim_mvw_location). Obviously I do not want the query I fire to know about materialized views and I fire it against the fact table. I see that for the fired query (Which needs aggregations along both Calendar and Location), is rewritten with just second materialized view but not the third. (Had set QUERY_REWRITE_INTEGRITY as TRUSTED) .
    Wanted to know whether there are limitations on Query Writes with nested materialized views? Thanks
    (Have given a simple testable example below. Pls ignore the values given in 'CALENDAR_IDs', 'PRODUCT_IDs' etc as they are the same for all the queries)
    -- Calendar hierarchy table
    CREATE TABLE CALENDAR_HIERARCHY_TREE
    (     "CALENDAR_ID" NUMBER(5,0) NOT NULL ENABLE,
    "HIERARCHY1_ID" NUMBER(5,0),
    "HIERARCHY2_ID" NUMBER(5,0),
    "HIERARCHY3_ID" NUMBER(5,0),
    "HIERARCHY4_ID" NUMBER(5,0),
    CONSTRAINT "CALENDAR_HIERARCHY_TREE_PK" PRIMARY KEY ("CALENDAR_ID")
    -- Location hierarchy table
    CREATE TABLE LOCATION_HIERARCHY_TREE
    (     "LOCATION_ID" NUMBER(3,0) NOT NULL ENABLE,
    "HIERARCHY1_ID" NUMBER(3,0),
    "HIERARCHY2_ID" NUMBER(3,0),
    "HIERARCHY3_ID" NUMBER(3,0),
    "HIERARCHY4_ID" NUMBER(3,0),
    CONSTRAINT "LOCATION_HIERARCHY_TREE_PK" PRIMARY KEY ("LOCATION_ID")
    -- Product hierarchy table
    CREATE TABLE PRODUCT_HIERARCHY_TREE
    (     "PRODUCT_ID" NUMBER(3,0) NOT NULL ENABLE,
         "HIERARCHY1_ID" NUMBER(3,0),
         "HIERARCHY2_ID" NUMBER(3,0),
         "HIERARCHY3_ID" NUMBER(3,0),
         "HIERARCHY4_ID" NUMBER(3,0),
         "HIERARCHY5_ID" NUMBER(3,0),
         "HIERARCHY6_ID" NUMBER(3,0),
         CONSTRAINT "PRODUCT_HIERARCHY_TREE_PK" PRIMARY KEY ("PRODUCT_ID")
    -- Fact table
    CREATE TABLE RETAILER_SALES_TBL
    (     "PRODUCT_ID" NUMBER,
    "PRODUCT_KEY" VARCHAR2(50 BYTE),
    "PLAN_ID" NUMBER,
    "PLAN_PERIOD_ID" NUMBER,
    "PERIOD_ID" NUMBER(5,0),
    "M1" NUMBER,
    "M2" NUMBER,
    "M3" NUMBER,
    "M4" NUMBER,
    "M5" NUMBER,
    "M6" NUMBER,
    "M7" NUMBER,
    "M8" NUMBER,
    "LOCATION_ID" NUMBER(3,0),
    "M9" NUMBER,
    CONSTRAINT "RETAILER_SALES_TBL_LOCATI_FK1" FOREIGN KEY ("LOCATION_ID")
    REFERENCES LOCATION_HIERARCHY_TREE ("LOCATION_ID") ENABLE,
    CONSTRAINT "RETAILER_SALES_TBL_PRODUC_FK1" FOREIGN KEY ("PRODUCT_ID")
    REFERENCES PRODUCT_HIERARCHY_TREE ("PRODUCT_ID") ENABLE,
    CONSTRAINT "RETAILER_SALES_TBL_CALEND_FK1" FOREIGN KEY ("PERIOD_ID")
    REFERENCES CALENDAR_HIERARCHY_TREE ("CALENDAR_ID") ENABLE
    -- Location dimension definition to promote query rewrite
    create DIMENSION LOCATION_DIM
    LEVEL CHAIN IS LOCATION_HIERARCHY_TREE.HIERARCHY1_ID
    LEVEL CONSUMER_SEGMENT IS LOCATION_HIERARCHY_TREE.HIERARCHY3_ID
    LEVEL STORE IS LOCATION_HIERARCHY_TREE.LOCATION_ID
    LEVEL TRADING_AREA IS LOCATION_HIERARCHY_TREE.HIERARCHY2_ID
    HIERARCHY PROD_ROLLUP (
    STORE CHILD OF
    CONSUMER_SEGMENT CHILD OF
    TRADING_AREA CHILD OF
    CHAIN
    -- Calendar dimension definition
    create DIMENSION CALENDAR_DIM
    LEVEL MONTH IS CALENDAR_HIERARCHY_TREE.HIERARCHY3_ID
    LEVEL QUARTER IS CALENDAR_HIERARCHY_TREE.HIERARCHY2_ID
    LEVEL WEEK IS CALENDAR_HIERARCHY_TREE.CALENDAR_ID
    LEVEL YEAR IS CALENDAR_HIERARCHY_TREE.HIERARCHY1_ID
    HIERARCHY CALENDAR_ROLLUP (
    WEEK CHILD OF
    MONTH CHILD OF
    QUARTER CHILD OF
    YEAR
    -- Materialized view with just joins needed for other views
    CREATE MATERIALIZED VIEW my_dim_mvw_joins build immediate refresh complete enable query rewrite as
    select product_id, lht.HIERARCHY1_ID, lht.HIERARCHY2_ID, lht.HIERARCHY3_ID, lht.location_id, cht.HIERARCHY1_ID year,
    cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week, m1, m3, m7, m9
    from retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
    WHERE RS.period_id = cht.CALENDAR_ID
    and RS.location_id = lht.location_id
    and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
    AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
    AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
    -- Materialized view which aggregate along calendar dimension
    CREATE MATERIALIZED VIEW my_dim_mvw_calendar build immediate refresh complete enable query rewrite as
    select product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID ,location_id, year, quarter, month, week,
    sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total,
    GROUPING_ID(product_id, location_id, year, quarter, month, week) dim_mvw_gid
    from my_dim_mvw_joins
    GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id,
    rollup (year, quarter, month, week);
    -- Materialized view which aggregate along Location dimension
    CREATE MATERIALIZED VIEW my_dim_mvw_location build immediate refresh complete enable query rewrite as
    select product_id, year, quarter, month, week, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id,
    sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1,
    GROUPING_ID(product_id, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id, year, quarter, month, week) dim_mvw_gid
    from my_dim_mvw_calendar
    GROUP BY product_id, year, quarter, month, week,
    rollup (HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id)
    -- SQL Query Fired (for simplicity have used SUM as aggregation operator for both, but they will be different)
    select product_id, year, HIERARCHY1_ID, HIERARCHY2_ID,
    sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1
    from
    select product_id, HIERARCHY1_ID , HIERARCHY2_ID , year,
    sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total
    from
    select product_id, lht.HIERARCHY1_ID , lht.HIERARCHY2_ID , lht.HIERARCHY3_ID ,lht.location_id, cht.HIERARCHY1_ID year, cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week,m1,m3,m7,m9
    from
    retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
    WHERE RS.period_id = cht.CALENDAR_ID
    and RS.location_id = lht.location_id
    and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
    AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
    AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
    GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id, year
    ) sales_time
    GROUP BY product_id, year,HIERARCHY1_ID, HIERARCHY2_ID
    This Query rewrites only with my_dim_mvw_calendar. (as saw in Query Plan and EXPLAIN_MVIEW). But we would like it to use my_dim_mvw_location as that has aggregations for both dimensions.

    blackhole001 wrote:
    Hi all,
    I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
    Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
    Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
    Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model.

  • AWM does not provide Materialized Views as potential data sources.

    Hi
    I would like to map OLAP dimensions and cubes directly to materialized views. The Oracle AWM tool, however, only displays Tables, Views and Synonyms as mapping objects and I have to indirectly map to normal views created over the materialized views.
    Why does Oracle enforce this limitation?
    Thanks
    Kind Regards
    Greg

    Greg,
    Not sure why AWM enforces this limitation, certainly Warehouse Builder does not enforce this rule (at least not to my knowledge). You could raise a bug/enhancement request with Support. However, my recommendation is to never to map directly to a source object, such as a fact table or materialized view, in AWM. This can create all sorts of problems as you move your AWM model across environments. I always suggest to my customers and consultants they create a view over their source objects and use the view within the mapping editor. It will give you more control over the flow of data into your cube/dimension since it allows you to define filters on the view.
    Hope this helps
    Keith Laker
    Oracle EMEA Consulting
    BI Blog: http://oraclebi.blogspot.com/
    DM Blog: http://oracledmt.blogspot.com/
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    BI Samples: http://www.oracle.com/technology/products/bi/samples/

  • Problem with Materialized Views after an export

    Hi @ everybody,
    At an Oracle 11g R2 (11.2.0.3.0) instance, all actual CPU's/SPU's are installed, on a Red Hat 6 Machine i have a problem with Materialized Views from a schema, which i have exportet from an old database machine on Oracle 10g (10.2.0.1.0) to the new machine.
    I've exportet with the old exp and imported with imp, because i know, that i get some strange errors because of the materialized views when i'm using the new expdp and impdp tools.
    At the old machine the materialized views are so programmed, that they get an update of data at a defined time like this:
    START WITH TRUNC(SYSDATE) + 21/24
          NEXT SYSDATE+1
    ...But after the export this "update function" of the materialized view is not available. So i have deleted that views and recreated them with the START WITH parameters. So now they are running.
    But why do i have this problem?
    Is this "START WITH" somewhere written as a job or so in, for example, DBMS_SCHEDULER or something else? So i had forgotten to export these jobs or where is that defined?
    Is this a bug?
    Thanks for answers and help!
    Best regards,
    David

    I can't remember the error of expdp/impdp. That is some days ago, i have to rebuild this.
    I think in my scenario for the import i don't need the TABLE_EXISTS_ACTION, because by importing at the new server i've just createt the naked tablespace for the data and the users, not more. So he didn't has something to overwrite.
    And i have to tell you: i'm just the dbA. The desining of the tables and materialized views is many years ago by installing the old server. I'm just to young in my company to know about the design of the instance and why it was designed so.
    Anyway: my problem is, that after the import of the schemas to a new server the "START WITH" option in the materialized views is not there anymore and i just want to why so i can think about a solution for that and create it with the database designers of my company.
    EDIT: And here are the SQL Statements for creating the Materialized Views:
    First, at the OLD Server (Oracle 10g 10.2.0.1.0)
      CREATE MATERIALIZED VIEW "DUPONT_CCG2_P"."PR_PRODUCT_ITEMS"
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "DUPONT_14523"
      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 DISTINCT
          PR_CUSTOMER_MASTER_DATA.CLIENT_ID,
          PR_CUSTOMER_MASTER_DATA.ILN_USER,
          PR_ARTICLE.EAN,
          PR_ARTICLE.CODE,
          PR_USED_ARTICLE_TEXT.ARTICLE_TEXT,
          PR_USED_ARTICLE_TEXT.LANG_CODE,
          PR_ARTICLE.SUP_ITEM_NO,
          PR_ARTICLE.OLD_ITEM_NO,
          PR_COMPANY_ITEM_MATCH.ITEM_BY_NO,
          PR_COMPANY_ITEM_MATCH.UOM_UNIT,
          PR_COMPANY_ITEM_MATCH.PRICE_UOM,
          PR_COMPANY_ITEM_MATCH.PRICE,
          PR_COMPANY_ITEM_MATCH.CURRENCY,
          PR_COMPANY_ITEM_MATCH.PRICE_QTY,
          PR_COMPANY_ITEM_MATCH.SALES_UNIT,
          PR_COMPANY_ITEM_MATCH.START_DATE,
          PR_COMPANY_ITEM_MATCH.END_DATE,
          PR_ARTICLE.UPDATED_AT
            FROM PR_ARTICLE, PR_COMPANY_ITEM_MATCH, PR_USED_ARTICLE_TEXT, PR_CUSTOMER_MASTER_DATA, PR_ADDRESS
            WHERE PR_ADDRESS.ORDER_TYPE='REP'
          AND PR_CUSTOMER_MASTER_DATA.ILN_USER=PR_ADDRESS.ILN_USER
          AND PR_COMPANY_ITEM_MATCH.ILN_USER=PR_ADDRESS.ILN_LINK
          AND PR_CUSTOMER_MASTER_DATA.SALES_ORG=PR_COMPANY_ITEM_MATCH.SALES_ORG
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_COMPANY_ITEM_MATCH.CLIENT_ID
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_ADDRESS.CLIENT_ID
          AND PR_ARTICLE.SUP_ITEM_NO=PR_COMPANY_ITEM_MATCH.SUP_ITEM_NO
          AND PR_COMPANY_ITEM_MATCH.SALES_ORG=PR_USED_ARTICLE_TEXT.SALES_ORG
          AND PR_ARTICLE.SUP_ITEM_NO=PR_USED_ARTICLE_TEXT.SUP_ITEM_NO
          AND PR_CUSTOMER_MASTER_DATA.LANG_CODE=PR_USED_ARTICLE_TEXT.LANG_CODE
          AND ( PR_COMPANY_ITEM_MATCH.END_DATE IS NULL OR to_date(PR_COMPANY_ITEM_MATCH.END_DATE,'YYYYMMDD') - sysdate > 0)
          AND ( PR_COMPANY_ITEM_MATCH.START_DATE IS NULL OR sysdate - to_date(PR_COMPANY_ITEM_MATCH.START_DATE,'YYYYMMDD') > 0)
    )And here the at the NEW Server (Oracle 11g R2 11.2.0.3.0)
      CREATE MATERIALIZED VIEW "DUPONT_CCG2_P"."PR_PRODUCT_ITEMS" ("CLIENT_ID", "ILN_USER", "EAN", "CODE", "ARTICLE_TEXT", "LANG_CODE", "LANR", "OLD_LANR", "ITEM_BY_NO", "UOM_UNIT", "PRICE_UOM", "PRICE", "CURRENCY", "PRICE_QTY", "SALES_UNIT", "START_DATE", "END_DATE", "UPDATED_AT")
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
    NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "DUPONT_14523"
      BUILD IMMEDIATE
      USING INDEX
      REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1
      USING DEFAULT LOCAL ROLLBACK SEGMENT
      USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
      AS (SELECT DISTINCT
          PR_CUSTOMER_MASTER_DATA.CLIENT_ID,
          PR_CUSTOMER_MASTER_DATA.ILN_USER,
          PR_ARTICLE.EAN,
          PR_ARTICLE.CODE,
          PR_USED_ARTICLE_TEXT.ARTICLE_TEXT,
          PR_USED_ARTICLE_TEXT.LANG_CODE,
          PR_ARTICLE.SUP_ITEM_NO,
          PR_ARTICLE.OLD_ITEM_NO,
          PR_COMPANY_ITEM_MATCH.ITEM_BY_NO,
          PR_COMPANY_ITEM_MATCH.UOM_UNIT,
          PR_COMPANY_ITEM_MATCH.PRICE_UOM,
          PR_COMPANY_ITEM_MATCH.PRICE,
          PR_COMPANY_ITEM_MATCH.CURRENCY,
          PR_COMPANY_ITEM_MATCH.PRICE_QTY,
          PR_COMPANY_ITEM_MATCH.SALES_UNIT,
          PR_COMPANY_ITEM_MATCH.START_DATE,
          PR_COMPANY_ITEM_MATCH.END_DATE,
          PR_ARTICLE.UPDATED_AT
            FROM PR_ARTICLE, PR_COMPANY_ITEM_MATCH, PR_USED_ARTICLE_TEXT, PR_CUSTOMER_MASTER_DATA, PR_ADDRESS
            WHERE PR_ADDRESS.ORDER_TYPE='REP'
          AND PR_CUSTOMER_MASTER_DATA.ILN_USER=PR_ADDRESS.ILN_USER
          AND PR_COMPANY_ITEM_MATCH.ILN_USER=PR_ADDRESS.ILN_LINK
          AND PR_CUSTOMER_MASTER_DATA.SALES_ORG=PR_COMPANY_ITEM_MATCH.SALES_ORG
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_COMPANY_ITEM_MATCH.CLIENT_ID
          AND PR_CUSTOMER_MASTER_DATA.CLIENT_ID=PR_ADDRESS.CLIENT_ID
          AND PR_ARTICLE.SUP_ITEM_NO=PR_COMPANY_ITEM_MATCH.SUP_ITEM_NO
          AND PR_COMPANY_ITEM_MATCH.SALES_ORG=PR_USED_ARTICLE_TEXT.SALES_ORG
          AND PR_ARTICLE.SUP_ITEM_NO=PR_USED_ARTICLE_TEXT.SUP_ITEM_NO
          AND PR_CUSTOMER_MASTER_DATA.LANG_CODE=PR_USED_ARTICLE_TEXT.LANG_CODE
          AND ( PR_COMPANY_ITEM_MATCH.END_DATE IS NULL OR to_date(PR_COMPANY_ITEM_MATCH.END_DATE,'YYYYMMDD') - sysdate > 0)
          AND ( PR_COMPANY_ITEM_MATCH.START_DATE IS NULL OR sysdate - to_date(PR_COMPANY_ITEM_MATCH.START_DATE,'YYYYMMDD') > 0)
    )The own differences i can see is at the "header". In the new one is the NOCOMPRESS LOGGING Option and in the first line the code has the columns diretcly defined.
    But, i think, for my problem this line is determining:
      REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT SYSDATE+1And this line is the same at both server.
    Edited by: David_Pasternak on 12.04.2013 00:06

  • Can't update master table when creating a materialized view log.

    Hi all,
    I am facing a very strange issue when trying to update a table on which I have created a materialized view log (to enable downstream fast refresh of MV's). The database I am working on is 10.2.0.4. Here is my issue:
    1. I can successfully update (via merge) a dimension table, call it TABLEA, with 100k updates. However when I create a materialized view log on TABLEA the merge statement hangs (I killed the query after leaving it to run for 8 hrs!). TABLEA has 11m records and has a number of indexes (bitmaps and btree) and constraints on it.
    2. I then create a copy of TABLEA, call it TABLEB and re-created all the indexes and constraints that exist on TABLEA. I created a materialzied view log on TABLEB and ran the same update....the merge completed in under 5min!
    The only difference between TABLEA and TABLEB is that the dimension TABLEA is referenced by a number of FACT tables (by FKs on the FACTS) however this surely should not cause a problem. I don't understand why the merge on TABLEA is not completing...even though it works fine on its copy TABLEB? I have tried rebuilding the indexes on TABLEA but this did not work.
    Any help or ideas on this would be most appreciated.
    Kind Regards
    Mitesh
    email: [email protected]

    Thats what I thought, the MVL will only read data that has changed since it was created and wont have the option to load in all the data as though it was made before the table was created.
    From what I have read, the MVL is quicker than a Trigger and I have some free code that prooved to work from a MVL using it as a reference to know what records to update. There is not that much to a MVL, a record ID and type of update, New, Update or Delete.
    I think what I will have to do is work on a the same principle for the MVL but use a Trigger as this way we can do a full reload if required at any point.
    Many thanks for your help.

  • Creating a DWMQY DIMENSION using Analytic Workspace Manager

    Hi everyone,
    I need some help creating a "time aware" (DAY, WEEK, MONTH, QUARTER, and YEAR) dimension using Analytic Workspace Manager.
    Let me give you some background. I'm coming from a traditional "Oracle Express" OLAP background where all our data is stored in cubes and these are defined, populated and operated on using OLAP DML, there is no SQL or traditional relational tables involved.
    I now want to pull data from relational tables into some OLAP cubes and am using Analytic Workspace Manager to do this (maybe this is not the best way?)
    Let me explain what I'm trying to achieve. In OLAP worksheet I can type the following DML commands:
    DEFINE MY_DAY DIMENSION DAY
    MAINTAIN MY_DAY ADD TODAY '01JAN2011'
    What this will do is create a "day dimension" and will populate it with values for each and every day between 1st Jan 2011 and today. It will be fully "time aware" and thus you can use date functions such as DAYOF to limit the MY_DAY dimension to all the Fridays etc. Similarly if I define a "month dimension" there will be an automatic implicit relationship between these two dimensions, this relationship and time aware cleverness is built into Oracle.
    However, a dimension defined using DML commands (and indeed all objects created using DML language) is not visible in Analytic Workspace Manager (as there is no metadata for them?) and for the life of me I cannot work out how to create such a dimension using AWM. If I create a "Time Dimension" then, as far as I can tell, this is not a proper time dimension but merely a text dimension and I, presume, I have to teach it time awareness.
    Can anyone help me? I have no issues creating, and populating cubes from relational tables using Analytic Workspace Manager, the only issue I have is creating a "proper" time aware dimension.
    Many thanks in anticipation.
    Ian.

    When a dimension is of type "TIME" in AWM, then for each member of that dimension, you need END_DATE and TIMESPAN attributes in addition to the key column and description column.
    So in your case, if there are 5 levels: DAY->WEEK->MONTH->QTR->YEAR
    then you will need atleast 15 columns in your source sql table/view
    or 20 columns if you have separate column for description.
    For example the columns in your source table/view could be:
    DAY_ID,
    DAY_DESC,
    DAY_END_DATE, (which will be that day's date)
    DAY_TIMESPAN, (which will be 1)
    WEEK_ID,
    WEEK_DESC,
    WEEK_END_DATE,
    WEEK_TIMESPAN,
    MONTH_ID,
    MONTH_DESC,
    MONTH_END_DATE,
    MONTH_TIMESPAN,
    QTR_ID,
    QTR_DESC,
    QTR_END_DATE,
    QTR_TIMESPAN,
    YEAR_ID,
    YEAR_DESC,
    YEAR_END_DATE,
    YEAR_TIMESPAN
    Just "map" this table/view to the 5-level time dimension in AWM.
    NOTE that behind-the-scenes lot of useful structures are automatically defined to support time-series measures,
    and there are lot of calculation templates available also.
    Since you came from Express background, I have to say that try to use new OLAP Expression Syntax when creating calculated measures instead of OLAP DML.
    Its very rare these days that we need OLAP DML.
    Edited by: Nasar on Nov 22, 2012 12:11 PM

  • Is it possible to create relational view on Analytic Workspace in Oracle 9i Release1

    Hi All,
    We are in the initial stages of Oracle 9i OLAP prototype. Since the current version of BIBeans 2.5 does not work with Release 2 of Oracle 9i OLAP, we are planning to use Oracle 9i OLAP Release 1. So can you please answer the following questions.
    1. Is it possible to create relational view on Analytic Workspace(like in Release 2) and populate the OLAP catalog, if so can you give me guidance to get the appropriate user guide. The OLAP DML guide in Release 1 talks about creating OLAP catalog metadata for Analytic Workspace using a metadata locator object.
    2, Is it advisable to use Oralce 9i OLAP Release 1? Does the Analytic Workspace and the corresponding BIBeans work in Release 1?
    Thank you,
    Senthil

    Analytic Workspaces (Express/multidimensional data objects and procedures written in
    the OLAP DML) are new to Oracle9i OLAP Release 2, you cannot find them in Release 1.
    BI Beans will soon (within a week) introduce a version on OTN that will work with Oracle9i OLAP Release 2.

Maybe you are looking for

  • How to block a business partner...in sales order????

    Hi all,            While generating the sales order....In the customer tab i will select one business partner from CFL,after choosing i want one particular customer to be blocked....means it should unable to post the sales order.....i know that i sho

  • JARs with JDBC/MySQL

    I'm trying to import com.mysql.jdbc.Driver and am trying to make reference to the JAR file (located in the 'jars' subdirectory from the JAR app) in my manifest file in the following way: Main-Class: UI Class-Path: jars/connector-java-sql.jarExcept wh

  • Apps audio goes of when Auto-lock is activated

    Hi folks I have a very annoying problem with my iPhone 3G, when I'm listening to music using FlyCast and 95.8 Capital FM apps the music stops when Auto-lock is activated after 2 minutes- I normally turnoff auto-lock but this reduces the battery life

  • What is the ReplacesDialogIDTime column used for in the CDR database?

    I have been writing some reports using SQL aganist the Lync CDR database - looking mainly at the SessionDetails and VoipDetails tables. I have come across some instances where the duration of the call (session start - session end) is not acurrate, bu

  • AutoUnattend.xml - activation issue

    Greetings, I am in the process of building an image via the Windows AIK, using those tools, to accumulate drivers etc. that is needed in that package. My issue arises when I inject the product key into AutoUnattend.xml using Windows SIM. Where is the