MS - contention with empty materialized view on demand - 10.2.0.4

Could somebody explain what is MS - contention? I've searched everywhere and got just that it is used to setup materialized view log. I need more deeper explanation. Why is it needed? And the main thing - I have this materialized view:
CREATE MATERIALIZED VIEW "CLIENT_MV"
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
BUILD IMMEDIATE
USING INDEX
REFRESH FAST ON DEMAND
WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS SELECT CLIENT_ID FROM CLIENT WHERE 1=0
And mlog on it. What activity can cause MS-contention on it? I tried concurrent updates on a master table, refreshed it at the same time, but can't get contention. May be it is important that I saw this contention in v$active_history view
Edited by: user6895786 on 26.02.2010 6:11

user626582 wrote:
Hi all
I have trouble on a 10.2.0.4. All Users have lost their Passwords, that means that the column password in the view dba_users is empty an Users can't login anymore.
I didn't found a logfile or something else. Have you got an idea ? Profiles eg ?
Thanks for your help.What is the error that the users are getting, invalid user name and password, is it? Did you do any recent patching of your system/db? I would suggest that you raise an SR with oracle as it would highly descreuctive to play with base tables on your own.
HTH
Aman....

Similar Messages

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

  • Empty materialized view

    Hi,
    i have a REFRESH FAST ON DEMAND materialized view (10g XE) which access data throught dblink(10.2g).
    This Materialized view had been functioning for months well, when one day i've found it empty.
    When i executed the creation query, it got the data.
    When i refreshed either fast or complete, it still remained empty.
    At the end i had to drop and re-create it and now it has the data.
    My question: how is it possible this behaviour? Whan can cause such problems?
    Thanks in advance.
    Bianca

    It's certainly allowed ...
    ME_XE?create table for_my_mv as select * from all_objects;
    Table created.
    ME_XE?alter table for_my_mv add constraint for_my_mv_pk primary key (object_id);
    Table altered.
    ME_XE?create materialized view test_mv as select * from for_my_mv@loopback where 1=0;
    Materialized view created.
    ME_XE?select * from test_mv;
    no rows selected
    ME_XE?select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    5 rows selected.
    ME_XE?Are you attempting to use some GUI tool to do this in, or SQLPLUS (on a client machine, or the server hosting the database)? What version of Oracle?

  • A problem with a Materialized View

    Hi,
    I have a ordinary table with a three column compound primary key (COL_Id, COL_ValidFrom, COL_CaseId)
    I also have a MV that selects from that table. This one compiles just fine. It looks like this:
    CREATE MATERIALIZED VIEW "MV_02"
    REFRESH FORCE ON COMMIT
    AS SELECT COL_Id, COL_ValidFrom, MAX(COL_CaseId) CaseId FROM TBL_MediaText GROUP BY COL_Id, COL_ValidFrom;
    Works fine. Now I'm trying to create a second MV that selects from the first MV. It looks like this:
    CREATE MATERIALIZED VIEW "MV_03"
    REFRESH FORCE ON COMMIT
    AS
    SELECT a.COL_Id, a.CaseId, a.COL_ValidFrom, NVL(MIN(b.COL_ValidFrom)-1, TO_DATE('2099-12-31','yyyy-mm-dd')) ValidTo
    FROM MV_02 a, MV_02 b
    WHERE a.COL_Id=b.COL_Id(+) AND a.COL_ValidFrom < b.COL_ValidFrom(+)
    GROUP BY a.COL_Id, a.CaseId, a.COL_ValidFrom;
    This one does not parse. (ORA-12054) There seem to be a probelem with the ON COMMIT command. I have searched the web and found some info on the subject. It tells me to create a MV log, wich I have. I've also tried to put count(*) and count(b.COL_validfrom). But it just wont work.
    I see a possibilty of yhe problem laying in te fact that I join using two parts of my PK. Also there might be a problem with the fact that i can't create a log for MV_02 WITH PRIMARY KEY. Or maybe you can't have a MV selecting from another MV?
    Do anyone know how i should specify my Logs and/or querys in order for this to parse?
    I'm using 10.1, and I do have the ON REFRESH COMMIT-privilege.
    Thanks!
    Message was edited by:
    DavidNils

    May be you are trying for this....I don't know how helpful is my solution for you.
    SQL> CREATE MATERIALIZED VIEW MVE
      2  TABLESPACE JAM
      3  REFRESH FORCE ON COMMIT
      4  AS SELECT D.DEPTNO,D.DNAME, E.ENAME, E.JOB FROM
      5  EMP E, DEPT D
      6  WHERE D.DEPTNO = E.DEPTNO(+)
      7  /
    Materialized view created.
    SQL> CREATE MATERIALIZED VIEW MVEF
      2  TABLESPACE JAM
      3  REFRESH FORCE WITH ROWID
      4  AS SELECT * FROM MVE;
    Materialized view created.Message was edited by:
    Jameel

  • Hi experts pls help me with this materialized view refresh time!!!

    Hi Expeerts ,
    Please clarify my doubt about this materialized view code
    [\n]
    CREATE MATERIALIZED VIEW SCHEMANAME.products_mv
    REFRESH WITH ROWID
    AS SELECT * from VIEW_TABLE@DATAOPPB;
    [n]
    Here i am creating a materialized view named products_mv of the view_table present in the remote server.Can anyone tell me when will my table product_mv will get refreshed if i follow this code.As what i read from the books is that the refresh period is implicit and is carried out by the database implicitly.so can u tell me suppose i insert 2 new records into my view_table when will this record get updated into my product_mv table.
    I cant use primary key approach so this is the approach i am following .Kindly help me in understanding when will refresh of records occur in the materialized view product_mv...Pls help
    regards
    debashis

    Hi Justin ,
    Yes, my database can reasonably schedule other jobs too .Its not an issue.
    Actually what i meant "fine in all aspects" is that will the matrerialized view will get refreshed w.r.t the documetum_v table present in my remote server.This is all i need to refresh my materialized view .
    I queries the DBA_JOBS table .I could see the following result i have pasted below:-
    [\n]
    NLS_ENV
    MISC_ENV INSTANCE
    dbms_refresh.refresh('"WORKFLOW"."PRODUCTS_MV2"');
    JOB LOG_USER PRIV_USER
    SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE
    NEXT_SEC TOTAL_TIME B
    INTERVAL
    FAILURES
    WHAT
    [n]
    here WORKFLOW"."PRODUCTS_MV2 is the materialized view i have created.So can u tell me that whether we can predict our refresh part is functioning fine from this data.If so how?
    Actually i am asking u in details as i dont have much exposure to materialized view .I am using it for the very first time.
    Regds
    debashis

  • Fast refresh materialized view on demand but not working

    Hi all,
    I've created a simple table called xx using the following statements:
    1.) create table xx(x1 varchar2(10),x2 varchar2(10),x3 varchar2(10);
    2.) alter table xx add primary key (x1,x2);
    I've also created a materialized log on xx using:
    3.) create materialized view log on xx;
    Finally, I've create a very simple materialized view based on the table xx using:
    4.) create materialized view mv_xx refresh fast on demand as select * from xx;
    The version of Oracle I'm currently using is:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE 9.2.0.6.0 Production
    TNS for 32-bit Windows: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    Everything seems to be ok. However when I execute the dbms_mview.refresh('mv_xx','f') after performing any DMLs like INSERT, DELETE or UPDATE statements to the xx table. The data never gets refreshed to mv_xx and it only works on the complete refresh. Could anyone help me please as I must have missed or misunderstood some of the points about materialized view. By the way, do I need to set any flags or alter any system or session parameters prior to creating the materialized view or any other related components. Thank you.
    Regards,
    John

    Yes, mv_xx is created in the same schema as xx. Do you have any ideas.

  • Problem with dropping materialized view

    Hi there,
    I have a range partitioned materialized view which I can't drop :(
    The view contains 2 columns and about 200.000 records. The actual size on disk
    is 80MB.
    The SQL in the view is:
    SELECT PHONENUMBER, MAX(CREATIONTIME) CREATIONTIME
    FROM CUSTOMERSCONTRACTS
    GROUP BY PHONENUMBER;
    After 3-4 hours I get: ORA-XXXX: End of communication file channel .....
    I have forgotten to mention that this view is created in a new tablespace that is
    completly empty on a brand new HDD.
    What should I do? How to I drop this view without any complains from the DBA
    that I'm making lage IO operations?

    Hello user6673838,
    I do indeed remember this bug, it was pain as its takes sysdba intervention to correct.  It's actually not specific to spatial but rather afflicts any materialized view utilizing a domain index.  It was fixed in the 11.2.0.4 update.  I believe there is a patch for 11.2.0.3.  If you are however stuck on earlier version have your dba first drop the table and then secondly drop the summary.  That will clear the decks and you can recreate the materialized view.
    Cheers,
    Paul

  • Database replication with updatable materialized view in oracle 10gR2

    I neet to set up 1 central server and two local databases ....the local database will hold materialized view....now how to replicate data...in this scenario...please help as soon as possible...i am in rush.....
    the database i use is oracle 10g Release 2
    Edited by: user9932019 on Sep 4, 2009 2:25 AM

    It's not a process that can be explained in a forums posting. You have to understand the steps.
    Here are some other examples :
    http://www.orafaq.com/wiki/Scripts#Oracle_Advanced_Replication_Scripts

  • Materialized view log with multiple materialized views

    DB: 9.2.0.8
    Yes its old. I am not allowed to upgrade it.
    I have a set of materialized views that are created off of 5 base tables. They do fast refreshes. So I have multiple materialized views for the same base table and same materialized view log.
    1. how do materialized view logs manage multiple dependent materialized views?
    2. How do I tell by looking at the materialized view log which rows have not been fast refresh for a specific materialized view?

    As a starter for 10 try reading: Materialized View Refresh : Log Population and Purge (Doc ID 236233.1) on MOS.
    Thanks
    Paul

  • Issue with creating materialized view

    Hi,
    We have a select query (containing joins, aggregates and UNION ALL’s) using which we are creating materialized views. We were able to create these mat views in development environment, however when tried to run the same scripts in a higher environment the creation never completes. The higher environment has three times more data than in Dev currently.
    The below operations complete well in time , but when we add “CREATE MATERIALIZED VIEW MAT_VIEW_NAME” to the select query it takes forever (we have cancelled the operation after waiting for more 1 hour)
    Select count(1) from the complete Mat. View query -     takes 3.2 min to complete - the query resullts in      3,010,068 rows
    Create Normal VIEW using complete Mat. View select query -     takes      3.06 sec     to complete
    Create table using complete Mat. View select query     takes 5.75 min to complete - the query resullts in           3,010,068
    Does anyone have an idea why this could be happening ? if you have ever faced this kind of issue, can you please provide pointers on how you were able to solve the problem. We are using Oracle 11g.
    Let me know if I have to provide any other information for you to understand the issue better.
    Thanks

    SELECT vis.uid, findet.yr, findet.ect, vis.ind,
    tm_view.col1_id, tm_view.col1_name,
    tm_view.col2_id, tm_view.col2_name,
    tm_view.col3_id, tm_view.col3_name,
    clnt.cl_id, clnt.cl_nm,
    prodparent_view.parent_cd,
    prodparent_view.parent_desc,
    prod_view.parent_cd,
    prod_view.parent_desc,
    prod_view.child_cd,
    prod_view.child_desc,
    SUM (value1), SUM (value2),
    SUM (value3), SUM (value4),
    SUM (value5), SUM (value6),
    SUM (value7), SUM (value8),
    SUM (value9), SUM (value10),
    SUM (value11), SUM (value12)
    FROM vis,
    (SELECT *
    FROM analytic_e,
    (SELECT table_val
    FROM TAB_CHECK s
    WHERE s.tgt_table_nm = 'ANALYTIC'
    AND s.table_val = 'ANALYTIC_E')
    WHERE table_val = 'ANALYTIC_E'
    UNION ALL
    SELECT *
    FROM analytic_o,
    (SELECT switch_val
    FROM tab_check s
    WHERE s.tgt_table_nm = 'ANALYTIC'
    AND s.switch_val = 'ANALYTIC_O')
    WHERE switch_val = 'ANALYTIC_O') findet,
    prod_view,
    prodparent_view,
    tm_view,
    clnt,
    (select to_number(to_char(ref_dt,'yyyy'))-1 year_agg from DATE_TABLE) tbabt
    WHERE tbabt.yr = findet.yr
    AND vis.cl_key = findet.cl_key
    AND tm_view.hi_key = findet.hi_key
    AND prod_view.child_cd = findet.prod_cd
    AND clnt.cl_key = findet.cl_key
    AND prodparent_view.child_cd = prod_view.parent_cd
    GROUP BY vis.uid, findet.yr, findet.ect, vis.ind,
    tm_view.col1_id, tm_view.col1_name,
    tm_view.col2_id, tm_view.col2_name,
    tm_view.col3_id, tm_view.col3_name,
    clnt.cl_id, clnt.cl_nm,
    prodparent_view.parent_cd
    prodparent_view.parent_desc
    prod_view.parent_cd
    prod_view.parent_desc
    prod_view.child_cd
    prod_view.child_desc
    Higher Environment
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 57M| 65G| | 20M (1)| 66:48:28 | | |
    | 1 | HASH GROUP BY | | 57M| 65G| 73G| 20M (1)| 66:48:28 | | |
    |* 2 | HASH JOIN | | 57M| 65G| | 109K (2)| 00:21:58 | | |
    | 3 | TABLE ACCESS BY INDEX ROWID | HIER | 2100 | 244K| | 172 (0)| 00:00:03 | | |
    |* 4 | INDEX RANGE SCAN | UK_HIER | 2100 | | | 16 (0)| 00:00:01 | | |
    |* 5 | HASH JOIN | | 57M| 59G| | 109K (1)| 00:21:52 | | |
    | 6 | VIEW | VW_GBF_25 | 1908 | 868K| | 2612 (1)| 00:00:32 | | |
    | 7 | HASH GROUP BY | | 1908 | 141K| | 2612 (1)| 00:00:32 | | |
    | 8 | VIEW | | 45107 | 3347K| | 2609 (1)| 00:00:32 | | |
    | 9 | UNION-ALL | | | | | | | | |
    | 10 | HASH UNIQUE | | 22518 | 1473K| 1872K| 1010 (1)| 00:00:13 | | |
    |* 11 | TABLE ACCESS FULL | HIER | 22518 | 1473K| | 650 (1)| 00:00:08 | | |
    | 12 | HASH UNIQUE | | 22518 | 1165K| 1512K| 947 (1)| 00:00:12 | | |
    |* 13 | TABLE ACCESS FULL | HIER | 22518 | 1165K| | 650 (1)| 00:00:08 | | |
    | 14 | HASH UNIQUE | | 71 | 1917 | | 652 (1)| 00:00:08 | | |
    |* 15 | TABLE ACCESS FULL | HIER | 22518 | 593K| | 650 (1)| 00:00:08 | | |
    |* 16 | HASH JOIN | | 64M| 38G| 4936K| 106K (1)| 00:21:16 | | |
    | 17 | VIEW | | 45107 | 4404K| | 2609 (1)| 00:00:32 | | |
    | 18 | UNION-ALL | | | | | | | | |
    | 19 | HASH UNIQUE | | 22518 | 1473K| 1872K| 1010 (1)| 00:00:13 | | |
    |* 20 | TABLE ACCESS FULL | HIER | 22518 | 1473K| | 650 (1)| 00:00:08 | | |
    | 21 | HASH UNIQUE | | 22518 | 1165K| 1512K| 947 (1)| 00:00:12 | | |
    |* 22 | TABLE ACCESS FULL | HIER | 22518 | 1165K| | 650 (1)| 00:00:08 | | |
    | 23 | HASH UNIQUE | | 71 | 1917 | | 652 (1)| 00:00:08 | | |
    |* 24 | TABLE ACCESS FULL | HIER | 22518 | 593K| | 650 (1)| 00:00:08 | | |
    |* 25 | HASH JOIN | | 3021K| 1550M| 15M| 24492 (1)| 00:04:54 | | |
    | 26 | PARTITION HASH ALL | | 491K| 10M| | 1059 (1)| 00:00:13 | 1 | 16 |
    | 27 | MAT_VIEW ACCESS FULL | VIS | 491K| 10M| | 1059 (1)| 00:00:13 | 1 | 16 |
    |* 28 | HASH JOIN | | 388K| 190M| 6056K| 12929 (1)| 00:02:36 | | |
    | 29 | TABLE ACCESS FULL | CLNT | 64540 | 5294K| | 411 (1)| 00:00:05 | | |
    |* 30 | HASH JOIN | | 388K| 159M| | 4072 (1)| 00:00:49 | | |
    | 31 | TABLE ACCESS FULL | DATE_TABLE | 2 | 16 | | 3 (0)| 00:00:01 | | |
    | 32 | VIEW | | 582K| 235M| | 4065 (1)| 00:00:49 | | |
    | 33 | UNION-ALL | | | | | | | | |
    | 34 | NESTED LOOPS | | 272K| 52M| | 1860 (1)| 00:00:23 | | |
    |* 35 | TABLE ACCESS BY INDEX ROWID| TAB_CHECK | 1 | 46 | | 1 (0)| 00:00:01 | | |
    |* 36 | INDEX UNIQUE SCAN | SYS_C0041157 | 1 | | | 0 (0)| 00:00:01 | | |
    | 37 | PARTITION RANGE ALL | | 272K| 40M| | 1859 (1)| 00:00:23 | 1 |1048575|
    | 38 | TABLE ACCESS FULL | ANALYTIC_E | 272K| 40M| | 1859 (1)| 00:00:23 | 1 |1048575|
    | 39 | NESTED LOOPS | | 309K| 58M| | 2205 (1)| 00:00:27 | | |
    |* 40 | TABLE ACCESS BY INDEX ROWID| TAB_CHECK | 1 | 46 | | 1 (0)| 00:00:01 | | |
    |* 41 | INDEX UNIQUE SCAN | SYS_C0041157 | 1 | | | 0 (0)| 00:00:01 | | |
    | 42 | PARTITION RANGE ALL | | 309K| 44M| | 2204 (1)| 00:00:27 | 1 |1048575|
    | 43 | TABLE ACCESS FULL | ANALYTIC_O | 309K| 44M| | 2204 (1)| 00:00:27 | 1 |1048575|
    Development
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 1696K| 1276M| | 291K (1)| 00:58:20 | | |
    | 1 | HASH GROUP BY | | 1696K| 1276M| 1325M| 291K (1)| 00:58:20 | | |
    |* 2 | HASH JOIN | | 1696K| 1276M| | 9721 (2)| 00:01:57 | | |
    | 3 | VIEW | | 15464 | 1132K| | 1855 (1)| 00:00:23 | | |
    | 4 | UNION-ALL | | | | | | | | |
    | 5 | HASH UNIQUE | | 7681 | 502K| | 618 (1)| 00:00:08 | | |
    |* 6 | TABLE ACCESS FULL | HIER | 7681 | 502K| | 617 (1)| 00:00:08 | | |
    | 7 | HASH UNIQUE | | 7681 | 375K| | 618 (1)| 00:00:08 | | |
    |* 8 | TABLE ACCESS FULL | HIER | 7681 | 375K| | 617 (1)| 00:00:08 | | |
    | 9 | HASH UNIQUE | | 102 | 2448 | | 618 (1)| 00:00:08 | | |
    |* 10 | TABLE ACCESS FULL | HIER | 7681 | 180K| | 617 (1)| 00:00:08 | | |
    |* 11 | HASH JOIN | | 371K| 252M| | 7847 (2)| 00:01:35 | | |
    | 12 | VIEW | | 15464 | 1510K| | 1855 (1)| 00:00:23 | | |
    | 13 | UNION-ALL | | | | | | | | |
    | 14 | HASH UNIQUE | | 7681 | 502K| | 618 (1)| 00:00:08 | | |
    |* 15 | TABLE ACCESS FULL | HIER | 7681 | 502K| | 617 (1)| 00:00:08 | | |
    | 16 | HASH UNIQUE | | 7681 | 375K| | 618 (1)| 00:00:08 | | |
    |* 17 | TABLE ACCESS FULL | HIER | 7681 | 375K| | 617 (1)| 00:00:08 | | |
    | 18 | HASH UNIQUE | | 102 | 2448 | | 618 (1)| 00:00:08 | | |
    |* 19 | TABLE ACCESS FULL | HIER | 7681 | 180K| | 617 (1)| 00:00:08 | | |
    |* 20 | HASH JOIN | | 122K| 71M| | 5987 (2)| 00:01:12 | | |
    |* 21 | TABLE ACCESS FULL | HIER | 7681 | 915K| | 617 (1)| 00:00:08 | | |
    |* 22 | HASH JOIN | | 122K| 57M| 4512K| 5368 (2)| 00:01:05 | | |
    |* 23 | HASH JOIN | | 9556 | 4395K| 3856K| 2409 (2)| 00:00:29 | | |
    | 24 | TABLE ACCESS FULL | CLNT | 74426 | 2979K| | 310 (1)| 00:00:04 | | |
    |* 25 | HASH JOIN | | 9556 | 4012K| | 1710 (2)| 00:00:21 | | |
    | 26 | TABLE ACCESS FULL | DATE_TABLE | 1 | 7 | | 3 (0)| 00:00:01 | | |
    | 27 | VIEW | | 19112 | 7894K| | 1706 (2)| 00:00:21 | | |
    | 28 | UNION-ALL | | | | | | | | |
    | 29 | MERGE JOIN CARTESIAN | | 19111 | 4068K| | 1701 (2)| 00:00:21 | | |
    |* 30 | TABLE ACCESS FULL | TAB_CHECK | 1 | 49 | | 3 (0)| 00:00:01 | | |
    | 31 | BUFFER SORT | | 248K| 40M| | 1698 (2)| 00:00:21 | | |
    | 32 | PARTITION RANGE ALL| | 248K| 40M| | 1698 (2)| 00:00:21 | 1 |1048575|
    | 33 | TABLE ACCESS FULL | ANALYTIC_E | 248K| 40M| | 1698 (2)| 00:00:21 | 1 |1048575|
    | 34 | MERGE JOIN CARTESIAN | | 1 | 537 | | 5 (0)| 00:00:01 | | |
    | 35 | PARTITION RANGE ALL | | 1 | 488 | | 2 (0)| 00:00:01 | 1 |1048575|
    | 36 | TABLE ACCESS FULL | ANALYTIC_O | 1 | 488 | | 2 (0)| 00:00:01 | 1 |1048575|
    | 37 | BUFFER SORT | | 1 | 49 | | 3 (0)| 00:00:01 | | |
    |* 38 | TABLE ACCESS FULL | TAB_CHECK | 1 | 49 | | 3 (0)| 00:00:01 | | |
    | 39 | PARTITION HASH ALL | | 810K| 16M| | 1456 (2)| 00:00:18 | 1 | 16 |
    | 40 | MAT_VIEW ACCESS FULL | VIS | 810K| 16M| | 1456 (2)| 00:00:18 | 1 | 16 |
    -----------------------------------------------------------------------------------------------------------------------------------------

  • How to create material via Idoc with empty material field

    Hello.
    I have to take over materials from a 46c system to an ECC5 system and I want to use Idocs.
    Some of the materials must keep their old numbers, some must change with a new number which have to be define automatically following the internal range number rules of the customizing.
    I thought we just had to make the matnr field empty in the E1MARAM segment and so, SAP would assign automatically the new number, but it doesn't work.
    I also tried to put '/' (nodata) character in the field, but I just reached to create an material with '/' number. :-(((((((.
    Does anyone know a solution ?
    Thank you in advance for all your advices.
    David

    Hello James and happy new year.
    Thank you for your answer.
    In fact, I already tried to leave the matnr field with blanks and for a material type which use internal numbers range. I hoped/thought it would have worked as you said but it wouldn't.
    About the external old numbers I keep, I think I don't have to use the field external_number of the E1MARA1 segment, because some of my tests showed me that it works good. Moreover, I don't really understand the reason why this field exists because the field matnr is here for.
    I presume that the external_number is maybe for another use I don't know, aren't you ?
    I've never used this segment for data take over.
    Do you know if the principle you described in your previous mail is also the same to apply to customers & vendors idocs ?
    Best regards.
    David

  • Problem with MATERIALIZED VIEW (snapshot)

    Hi,
    I've any problem with creating MATERIALIZED VIEW (snapshot)
    My table is ROOMS:
    SQL> DESC ROOMS
    Name Null? Type
    LS_ID VARCHAR2(32)
    BL_ID NOT NULL VARCHAR2(32) PRIMARY KEY1
    FL_ID NOT NULL VARCHAR2(4) PRIMARY KEY2
    RM_ID NOT NULL VARCHAR2(8) PRIMARY KEY3
    SITE_ID VARCHAR2(32)
    SQL> SELECT COUNT(*)
    2 FROM ROOMS;
    COUNT(*)
    203973
    SQL> SELECT COUNT (TOT)
    2 FROM (SELECT COUNT(*) TOT, LS_ID, SITE_ID
    3 FROM ROOMS
    4 GROUP BY LS_ID, SITE_ID);
    COUNT(TOT)
    11673
    I'd like to create one MATERIALIZED VIEW that refresh every 30 seconds when I insert, update or delete on ROOMS table.
    I tried this:
    CREATE MATERIALIZED VIEW ROOMS_SNAP
    BUILD IMMEDIATE
    REFRESH complete
    START WITH to_date(sysdate,'dd/mm/yyyy hh24:mi:ss')
    NEXT sysdate + 30/86400
    disable QUERY REWRITE
    AS
    SELECT LS_ID, SITE_ID
    FROM ROOMS
    GROUP BY LS_ID, SITE_ID
    but when I insert, update or delete one record on ROOMS table, ROOMS_SNAP not refresh.
    What I wrong?
    How Can I write MATERIALIZED VIEW to maintain synchronization
    between ROOMS_SNAP AND LS_ID, SITE_ID by ROOMS?
    Thanks

    Try this way:
    SQL> SHOW PARAMETER JOB
    NAME                                 TYPE        VALUE
    job_queue_processes                  integer     0
    SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=20 SCOPE=MEMORY;
    SQL> create materialized view log on emp tablespace jam_ts
      2  with rowid, primary key;
    Materialized view log created.
    SQL> create materialized view emp_mat
      2  tablespace jam_ts
      3  refresh fast start with sysdate
      4  next sysdate + interval '15' second as
      5  select * from emp where deptno=30;
    Materialized view created.
    SQL> update  emp
      2  set     ename=lower(ename)
      3  where   deptno=30;
    6 rows updated.
    SQL> commit;
    Commit complete.
    ---"After 15 seconds it will be refreshed automatically...."
    SQL> select * from emp_mat;
      EMPNO ENAME      JOB           MGR HIREDATE      SAL    COMM  DEPTNO
       7499 allen      SALESMAN     7698 20-FEB-81    1600     300      30
       7521 ward       SALESMAN     7698 22-FEB-81    1250     500      30
       7654 martin     SALESMAN     7698 28-SEP-81    1250    1400      30
       7698 blake      MANAGER      7839 01-MAY-81    2850              30
       7844 turner     SALESMAN     7698 08-SEP-81    1500       0      30
       7900 james      CLERK        7698 03-DEC-81     950              30
    6 rows selected.Message was edited by:
    Jameel

  • Materialized Views - DIRLOAD_LIMITEDDML

    Hello, I'm currently using Oracle 11g.
    Creating a fast refreshable MVIEW with max function on select causes the fast refreshable limitation to DIRLOAD_LIMITEDDML. However, even with an empty materialized view log on the source table, the materialized view keeps COMPLETE refreshing.
    Here is my DDL:
    CREATE materialized VIEW Log ON DW.FACT_BU_INV_DET_DET
    WITH ROWID,
    SEQUENCE(
    INV_ID,
    DETAIL_ID,
    ITEM,
    ITEM_STEP,
    AMMOUNT_BILL,
    QUANTITY_RD,
    QUANTITY_ST,
    QUANTITY_LP,
    START_STEP,
    END_STEP,
    LINE_TYPE,
    AMMOUNT_CR,
    ORG,
    UNIT,
    BI_FLAG,
    ORG_ID,
    UNIT_ID
    ) INCLUDING NEW VALUES;
    CREATE materialized VIEW dw.fact_bu_inv_step_mstep_mv
    build IMMEDIATE
    REFRESH FAST ON demand
    ENABLE query rewrite
    as
    SELECT s.inv_id,s.item,Max(s.item_step) m_step
    FROM
    dw.fact_bu_inv_det_det s
    GROUP BY s.inv_id,s.item
    Any ideas?
    Thanks in advance,
    Pedro Almeida

    What do you mean by "complex query"? Oracle defines a complex query as one that cannot be fast refreshable, so that you could not get a delta. Many queries that people would describe as complex, however, are not technically complex in an Oracle replication context or can be made non-complex.
    Justin

  • How to speed up fast refresh of materialized view without primary key

    Thought I'd share this info, as I couldn't find anything on here to help me diagnose the issue:
    I had a materialized view that was taking longer to perform a fast refresh than it took to perform a complete refresh. My mview had no primary key, as the base table had no primary key.
    I created a trace file for the session and saw references to a column M_ROW$$ in my mview. Nowhere in the data dictionary could I find a reference to the m_row$$ column in my mview, but apparently it exists and is created automatically. After creating the index below, the fast refresh took 6 minutes to add 500k rows to the materialized view. (versus 4+ hours without the index) When I looked in the trace file, I noticed that for each row in the mview log, it first tries to update the mview with an UPDATE statement, then it performs an insert of the new data. Seems like it should be able to determine whether to perform an update or insert based on the DMLTYPE$$ column of the mview log. What was killing my performance was the UPDATE phase. Since I had no primary key on the mview, and no index on the m_row$$ column, the UPDATE phase was performing a full table scan of my mview for every row in the mview log. I was expecting it to be smart enough to only perform inserts, as the only transactions against the base table were inserts.
    In summary: If you have a materialized view without a primary key, create an index on the m_row$$ column of the mview, even though no such column displays in the data dictionary.
    ex:
    CREATE MATERIALIZED VIEW mv_minidrr ...
    CREATE INDEX pk_mv_minidrr ON mv_minidrr(m_row$$) ...

    Well, there indeed is a column called M_ROW$$
    Your MLOG$_EMP is nothing but the materialized view log on the base table.
    SQL> create  materialized view log on emp with rowid ;
    Materialized view log created.
    SQL> create materialized view emp_mview refresh fast on demand with rowid as select * from emp ;
    Materialized view created.
    SQL> desc mlog$_emp
    Name                                                  Null?    Type
    M_ROW$$                                                        VARCHAR2(255)
    SNAPTIME$$                                                     DATE
    DMLTYPE$$                                                      VARCHAR2(1)
    OLD_NEW$$                                                      VARCHAR2(1)
    CHANGE_VECTOR$$                                                RAW(255)
    SQL> select table_name, column_name from user_tab_columns where column_name = 'M_ROW$$' ;
    TABLE_NAME                     COLUMN_NAME
    MLOG$_EMP                      M_ROW$$
    1 row selected.
    SQL>

  • Problem refreshing Materialized View in SQL Developer

    I have a database schema with a Materialized View (MV) that updates a products table shown on a website. This schema was recently imported to an 11g database from 8i, but since this import I have been unable to refresh my schema’s Materialized View.
    The MV_PRODUCT_MASTER Materialized View attaches price data to product data that is stored in a normal WEB_PRODUCT table, and create an MV table as a result. The output MV table is what the website pulls data from to display to the site users. Since it is an MV table, this table cannot be edited directly. In order to change, say, a product description, I need to alter the description field in WEB_PRODUCT and manually refresh the MV_PRODUCT_MASTER table. Only through the refresh will the upstream edits appear in the MV_PRODUCT_MASTER table and be visible on the website.
    In my old 7.6.0.11 copy of TOAD, I could manually refresh these MVs easily, by opening the “Snapshots” tab, right clicking on the MV I wanted to refresh and selecting the “Refresh” option. Since the schema was imported to 11g, I have been using the Oracle SQLDeveloper tool to manage the schema. SQLDeveloper doesn’t have a clear method for manually refreshing an MV, or else the method I am using isn’t working.
    If I right click on the MV_PRODUCT_MASTER Materialized View object, and choose “Other Actions”, I see the following choices:
    Shrink Materialized View
    Compile Materialized View
    Force Materialized View Refresh
    Rebuild Materialized View
    …I assumed that “Force Materialized View Refresh” was the right choice, and chose that. This option displays the SQL:
    alter materialized view "WEBADMIN"."MV_PRODUCT_MASTER" consider fresh
    When I apply this, I get the message: “Materialized view “MV_PRODUCT_MASTER” has been set torefreshed”. However, no changes appear in the MV output table. i.e. if I make a specific change to a row in the WEB_PRODUCT table, the change is not being carried into the MV_PRODUCT_MASTER table, so that indicated that the refresh is not actually happening. The MV table appears to believe it is being refreshed:
    REWRITE_CAPABILITY     GENERAL
    REFRESH_MODE     DEMAND
    REFRESH_METHOD     COMPLETE
    BUILD_MODE     IMMEDIATE
    FAST_REFRESHABLE     NO
    LAST_REFRESH_TYPE     COMPLETE
    LAST_REFRESH_DATE     06-APR-10
    STALENESS     UNKNOWN
    …but it isn’t showing any changes.
    What am I doing wrong? Is there a plain SQL statement I can run in order to run these refreshes, instead of using the SQLDeveloper GUI? Thanks for any advice on this.

    Hi Blama,
    DDL for Index-organized Materialized Views is generated in the Early Adopter release 4.1.0.866, which is now available for download.
    The Organization on the Table that is implemented as the Materialized View should be set to INDEX, and the Table's IOT properties will be used during DDL generation.
    David

Maybe you are looking for