Advice on materialized view.

Hello everybody,
I have a question and I hope you can advise. Imagine the following (simplified) model.
CREATE TABLE players
  player_id NUMBER(15) PRIMARY KEY,
  player_name VARCHAR2(100) NOT NULL,
  creation_date DATE,
  birth_date DATE
  -- around 20 other fields (firstname, different sizes, weights...)
CREATE TABLE competitions
  id_competition NUMBER(15) PRIMARY KEY,
  competition_name VARCHAR2(100),
  start_date DATE,
  end_date DATE,
  creator_id NUMBER(15), -- FOREIGN KEY TO PLAYERS.
  winner_id NUMBER(15)   -- FOREIGN KEY TO PLAYERS.
  -- around 20 other fields
CREATE TABLE objectives
  id_objective NUMBER(15) PRIMARY KEY,
  objective_name VARCHAR2(100),
  id_competition NUMBER(15),  -- FOREIGN KEY TO COMPETITIONS
  creator_id NUMBER(15),   -- FOREIGN KEY TO PLAYERS.
  winner_id NUMBER(15),    -- FOREIGN KEY TO PLAYERS.
  start_date DATE,
  is_public NUMBER(1),
  restrictions VARCHAR2(100)
  -- around 20 other fields
);[Foreign keys are all indexed]
The table players has around 30 million records.
The table competitions has around 10 million records.
The table objectives has around 70 million records.
I have a materialized view which JOIN between all these tables. Something like this:
SELECT comp.id_competition, comp.competition_name, /* comp.... */
       comp_cre.player_name, /*, comp_cre....*/
       comp_win.player_name, /*, comp_cre....*/
       obj.objective_name,   /*, obj....*/
       obj_cre.player_name,  /*, obj_cre....*/
       obj_win.player_name   /*, obj_cre....*/
       -- some analytics rank() OVER, COUNT() OVER...
  FROM competitions comp
  LEFT JOIN players comp_cre
         ON comp.creator_id = comp_cre.player_id
  LEFT JOIN players comp_win
         ON comp.winner_id = comp_win.player_id
INNER JOIN objectives obj
         ON obj.id_competition = comp.id_competition
  LEFT JOIN players obj_cre
         ON comp.creator_id = obj_cre.player_id
  LEFT JOIN players obj_win
         ON comp.winner_id = obj_win .player_id;THe materialized view is refreshed everyday. But since we have huge amount of data it takes a while to run. The size of the materialized view is more than 15GB. It is normal that the plan generate full table scans on these 3 tables... Since, that the goal. REtrieve all the data to make a big result set;
I was wondering if any of you has an idea on how I can speed up the refresh? I can not add materialized view logs on each dependent table. Is it possible to tell Oracle to work in different Thread? SOmething like the first 5 milions competitions are done in a thread, and another 5 milions in another thread? I have a very robust machines. 128GB ram and 64 CPU. Any suggestion?? I'm using Oracle 10g.
THank you

With 64 CPUs, you should certainly look at parallelizing the MV refresh:
http://www.doug.org/newsletter/march/MV_Refresh_Parallel.pdf
Iordan Iotzov
http://iiotzov.wordpress.com/

Similar Messages

  • Materialized View creation  advice and SQL advice

    I want to create a materialized view for the table below. The materialized view should query data from only this table and i want to join 2 rows to one.
    The key for the joins are the column internal_correlation_id which is unique for request/response pair.
    The table is updated every day with 2 million rows.
    What type of materialized view should i use and how can i query to get one row?
    CREATE TABLE EVENT (
           caller_id                              VARCHAR2(255)          NOT NULL
         , service_id                         VARCHAR2(255)          NOT NULL
         , country_code                         VARCHAR2(2)
         , internal_correlation_id                  VARCHAR2(255)          NOT NULL  -- Unique for request response pair
         , received_date                         DATE                    NOT NULL
         , status                              VARCHAR2(20)
         , queue_name                         VARCHAR2(255)          NOT NULL
         , USER_ID                              VARCHAR2(50)
         , engine_id                         VARCHAR2(50)
         , tracking_correlation_id                  VARCHAR2(2000)
         , mnc                              VARCHAR2(20)
         , mcc                              VARCHAR2(20)
         , request_type                         VARCHAR2(50)  -- REQUEST or RESPONSE
         , app_id                              VARCHAR2(50)
         , failure_code                         VARCHAR2(50)
         , failure_string                            VARCHAR2(255)
         , created_date                          DATE DEFAULT SYSDATE
        , updated_date                              DATE DEFAULT SYSDATE
        DB release 11G release 1
    Edited by: Alekons01 on Mar 24, 2012 2:43 PM

    Anyway, I don't believe you will be able to create MV with fast refresh. MV with complete refresh:
    CREATE MATERIALIZED VIEW event_mv
      BUILD IMMEDIATE
      REFRESH COMPLETE ON DEMAND
      AS
        SELECT  e1.caller_id req_caller_id,
                e1.service_id req_service_id,
                e1.country_code req_country_code,
                e1.internal_correlation_id req_internal_correlation_id,
                e1.received_date req_received_date,
                e1.status req_status,
                e1.queue_name req_queue_name,
                e1.user_id req_user_id,
                e1.engine_id req_engine_id,
                e1.tracking_correlation_id req_tracking_correlation_id,
                e1.mnc req_mnc,
                e1.mcc req_mcc,
                e1.request_type req_request_type,
                e1.app_id req_app_id,
                e1.failure_code req_failure_code,
                e1.failure_string req_failure_string,
                e1.created_date req_created_date,
                e1.updated_date req_updated_date,
                e2.caller_id rsp_caller_id,
                e2.service_id rsp_service_id,
                e2.country_code rsp_country_code,
                e2.internal_correlation_id rsp_internal_correlation_id,
                e2.received_date rsp_received_date,
                e2.status rsp_status,
                e2.queue_name rsp_queue_name,
                e2.user_id rsp_user_id,
                e2.engine_id rsp_engine_id,
                e2.tracking_correlation_id rsp_tracking_correlation_id,
                e2.mnc rsp_mnc,
                e2.mcc rsp_mcc,
                e2.request_type rsp_request_type,
                e2.app_id rsp_app_id,
                e2.failure_code rsp_failure_code,
                e2.failure_string rsp_failure_string,
                e2.created_date rsp_created_date,
                e2.updated_date rsp_updated_date
          FROM  event e1,
                event e2
          WHERE e2.internal_correlation_id = e1.internal_correlation_id
            AND e1.request_type = 'REQUEST'
            AND e2.request_type = 'RESPONSE'
    /SY.

  • Need help on tuning materialized view refresh

    Hi All,
    I am working on materialized view refresh tuning.Initially it was complete refresh and used to take more than 90 mins to complete.
    I changed it to fast refresh now it is completing fast. Now i have partitioned the base tables gl_balances and gl_code_combinations of column code_combination_id and created a local index on column code_combination_id then i am trying to partition the materialized on the same column to take advantage of partition change tracking.
    Size of gl_balances base tables is 40Gb and all others tables sizes are small. In where clause there all the 4 tables are mapped. If i will create the partition only on code_combination_id will i the materialized will become the candidate for partition change tracking. As i know it will be applicable for PCT. I need expert advice on this.
    While doing a fast refresh. the refresh takes less time. when there is a change in gl_balances , gl_code_combinations or gl_periods it completes in 20-30 mins. When there is a change in gl_set_of_books tables. It creates a problem here.DEL query takes more than 48 hours to complete.
    CREATE MATERIALIZED VIEW apps.BAL_PART
    REFRESH FAST ON DEMAND
    ENABLE QUERY REWRITE as
    SELECT GL.GL_CODE_COMBINATIONS21.ROWID C1,GL.GL_BALANCES21.ROWID C2, GL.GL_SETS_OF_BOOKS.ROWID C3,
    GL.GL_PERIOD.ROWID C4,
    "GL"."GL_BALANCES21"."ACTUAL_FLAG" ,
    "GL"."GL_BALANCES21"."CURRENCY_CODE" ,
    "GL"."GL_BALANCES21"."PERIOD_NUM" ,
    "GL"."GL_BALANCES21"."PERIOD_YEAR" ,
    "GL"."GL_BALANCES21"."SET_OF_BOOKS_ID" "SOB_ID",
    "GL"."GL_CODE_COMBINATIONS21"."CODE_COMBINATION_ID" "CCID",
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT1" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT10" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT11" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT12" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT13" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT14" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT2" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT3" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT4" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT5" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT6" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT7" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT8" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT9" ,
    "GL"."GL_PERIODS"."PERIOD_NAME" ,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal_Cr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal_Cr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) Open_Bal_Dr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Close_Bal_Dr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) -
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal,
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Period_Cr,
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Period_Dr
    FROM GL.GL_CODE_COMBINATIONS21,
    GL.GL_BALANCES21,
    GL.GL_SETS_OF_BOOKS,
    GL.GL_PERIODS
    WHERE GL.GL_BALANCES21.CODE_COMBINATION_ID =GL.GL_CODE_COMBINATIONS21.CODE_COMBINATION_ID
    AND GL.GL_SETS_OF_BOOKS.SET_OF_BOOKS_ID = GL.GL_BALANCES21.SET_OF_BOOKS_ID
    AND GL.GL_PERIODS.PERIOD_NUM = GL.GL_BALANCES21.PERIOD_NUM
    AND GL.GL_PERIODS.PERIOD_YEAR = GL.GL_BALANCES21.PERIOD_YEAR
    AND GL.GL_PERIODS.PERIOD_TYPE = GL.GL_BALANCES21.PERIOD_TYPE
    AND GL.GL_PERIODS.PERIOD_NAME = GL.GL_BALANCES21.PERIOD_NAME
    AND GL.GL_PERIODS.PERIOD_SET_NAME = GL.GL_SETS_OF_BOOKS.PERIOD_SET_NAME
    and gl.GL_CODE_COMBINATIONS21.summary_flag != 'Y'TRACE 1046 del statement
    DELETE FROM "APPS"."apps.BAL_PART" SNA$
    WHERE "C3" IN (SELECT /*+ NO_MERGE  */ * FROM (SELECT 
      CHARTOROWID("MAS$"."M_ROW$$") RID$     FROM "GL"."MLOG$_GL_SETS_OF_BOOKS"
      "MAS$"   WHERE "MAS$".SNAPTIME$$ > :B_ST1 ) AS OF SNAPSHOT(:B_SCN) MAS$)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1  17759.00  171782.99  159422121    1267371 2564144739           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2  17759.00  171782.99  159422121    1267371 2564144739           0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 175  (APPS)   (recursive depth: 1)
    Rows     Row Source Operation
          0  DELETE  apps.BAL_PART (cr=0 pr=0 pw=0 time=0 us)
    193128740   NESTED LOOPS  (cr=592437 pr=592422 pw=0 time=945244160 us cost=339302 size=168 card=1)
          3    SORT UNIQUE (cr=7 pr=0 pw=0 time=15832 us cost=2 size=138 card=1)
         24     TABLE ACCESS FULL MLOG$_GL_SETS_OF_BOOKS (cr=7 pr=0 pw=0 time=19 us cost=2 size=138 card=1)
    193128740    INDEX RANGE SCAN C3BOOKS (cr=592430 pr=592422 pw=0 time=789499200 us cost=339299 size=3318314250 card=110610475)(object id 2114736)
    error during execute of EXPLAIN PLAN statement
    ORA-08187: snapshot expression not allowed here
    parse error offset: 314
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                   159520897        2.12     144415.96
      latch: cache buffers chains                   134        0.06          0.68
      latch: undo global data                        33        0.02          0.15
      latch: object queue header operation          521        0.02          0.53
      log file switch (private strand flush incomplete)
                                                    532        0.31         28.26
      resmgr:cpu quantum                            155        1.40         13.49
      resmgr:internal state change                   25        0.11          2.21
      latch free                                     10        0.00          0.00
      latch: cache buffers lru chain                  4        0.00          0.00
      rdbms ipc reply                               489        0.02          0.54
      reliable message                              587        0.00          0.56
      latch: row cache objects                        3        0.00          0.00
    ********************************************************************************GL_SETS_OF_BOOKS has only 6 rows. I know there is complete refresh as a option which will again take more than 90 mins.
    I want to do the fast refresh. Tables rows details below.
    SQL> select count(*) from gl.gl_code_combinations21;
    COUNT(*)
    3075255
    SQL> select count(*) from gl.GL_PERIODS;
    COUNT(*)
    1160
    SQL> select count(*) from gl.gl_balances21;
    COUNT(*)
    477613527
    SQL> select count(*) from gl.gl_sets_of_books;
    COUNT(*)
    6gl_sets_of_books has less rows. Whenever there is a change then it mapped to huge rows hence during materialized view has delete huge number of rows.
    select count(*) from apps.BAL_PART group by C3;
    C3 is the rowid which is present in create materialized statement.
    COUNT(*)
    292927011
    210215
    69330
    184406971
    Is there any way to improve the plan. As i created a partition on code_combination_id and local index on code_combination_id which will not help in set_of_books_id case. I dont PCT will help here or not. Is it possible to use PCT refresh by equipartitioning only one column in where clause.
    Please assist me in improving refresh of materialized view using fast refresh.
    Thanks and Regards,
    Edited by: user646034 on Feb 23, 2013 11:13 PM
    Edited by: user646034 on Feb 23, 2013 11:19 PM
    Edited by: user646034 on Feb 23, 2013 11:46 PM
    Edited by: user646034 on Feb 25, 2013 11:46 AM

    Hi
    The below explain without index and with index.
    /* MV_REFRESH (DEL) */ DELETE FROM "APPS"."BAL_PART                                                                                                                                                                                                                                                                                                                                                                                                                
    " SNA$ WHERE "C3" IN (SELECT /*+ NO_MERGE  */ * FROM (SELECT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    CHARTOROWID("MAS$"."M_ROW$$") RID$     FROM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    "GL"."MLOG$_GL_SETS_OF_BOOKS" "MAS$"   WHERE "MAS$".SNAPTIME$$ > :B_ST1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    ) AS OF SNAPSHOT(:B_SCN) MAS$)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
    Plan hash value: 2704021294                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Id  | Operation            | Name                          | E-Rows |E-Bytes| Cost (%CPU)| E-Time   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   0 | DELETE STATEMENT     |                               |        |       |   339K(100)|          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   1 |  DELETE              | BAL_PART                          |        |       |            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   2 |   NESTED LOOPS       |                               |      1 |   168 |   339K  (1)|999:59:59 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   3 |    SORT UNIQUE       |                               |      1 |   138 |     2   (0)| 00:02:31 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   4 |     TABLE ACCESS FULL| MLOG$_GL_SETS_OF_BOOKS        |      1 |   138 |     2   (0)| 00:02:31 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   5 |    INDEX RANGE SCAN  | C3BOOKS                       |    110M|  3164M|   339K  (0)|999:59:59 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    If i will not use the C3 index then the query will use the belolw plan, I guess this will also take same time or more time.
    |   0 | DELETE STATEMENT       |                               |        |       |  9743K(100)|          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    |   1 |  DELETE                | BAL_PART                          |       |            |          |                                                                                                                                                                                                                                                                                                                                                                                                     

  • Materialized View  with Joins and Possibilities of Partitioning

    Hi,
    We have a materialized view which has a data to query around 12 gb. The query goes some thing like
    this.
      Select a.c1,a.c2,b.c1,b.c2,c.c1,c.c2
      from a,b,c
      where a.c1=b.c1
      --and the where condition goes on...
      --i.e Basically joining 3 different tables with complex join conditions but without any group functions and subqueries.
       Now i have few questions here.
    Firstly as the Mview is created with joins we will have to create separate logs for each tables and we have did the same. The logs are created with rowid and sequence for better performance during refresh.
    Question No 1
    Is this is a best approach for materializing a query with complex join conditions. Or Is it better to make 3 different materialized views for each 3 tables and join those 3 MViews and write a query for my report. I ask this question just to make sure the refresh time is brought down by this method. But as such as we have created 3 different logs for 3 tables the refresh must be happening separately.
    Question No 2
    Data is likely to grow faster and faster on this. So we have a idea of making this a partitioned Mview. Can the Pro's advice me on this and suggest me the right practice for the same and help me to correct links from where i can pick a example and continue from there.
    Question No 3
    How to find whether the materialized view has refreshed on a fast mode or complete mode after the last refresh.
    Apart from querying and checking the rowid which i feel is quiet cumbersome for a mview with a data volume like what we have. By default when i see the info in TOAD for this Mview it shows Refresh Mode as "Force". But how to ascertain this.
    Thanks in anticipation for a good round of discussion

    Hi,
    We have a materialized view which has a data to query around 12 gb. The query goes some thing like
    this.
      Select a.c1,a.c2,b.c1,b.c2,c.c1,c.c2
      from a,b,c
      where a.c1=b.c1
      --and the where condition goes on...
      --i.e Basically joining 3 different tables with complex join conditions but without any group functions and subqueries.
       Now i have few questions here.
    Firstly as the Mview is created with joins we will have to create separate logs for each tables and we have did the same. The logs are created with rowid and sequence for better performance during refresh.
    Question No 1
    Is this is a best approach for materializing a query with complex join conditions. Or Is it better to make 3 different materialized views for each 3 tables and join those 3 MViews and write a query for my report. I ask this question just to make sure the refresh time is brought down by this method. But as such as we have created 3 different logs for 3 tables the refresh must be happening separately.
    Question No 2
    Data is likely to grow faster and faster on this. So we have a idea of making this a partitioned Mview. Can the Pro's advice me on this and suggest me the right practice for the same and help me to correct links from where i can pick a example and continue from there.
    Question No 3
    How to find whether the materialized view has refreshed on a fast mode or complete mode after the last refresh.
    Apart from querying and checking the rowid which i feel is quiet cumbersome for a mview with a data volume like what we have. By default when i see the info in TOAD for this Mview it shows Refresh Mode as "Force". But how to ascertain this.
    Thanks in anticipation for a good round of discussion

  • 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

  • MATERIALIZED VIEW becamed to ZOMBIE :(  What Can I do ?

    Hi! Can anybody give me an advice about this ?
    look:
    10:27:23 ARCGIS2@sgp >drop MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW";
    Materialized view dropped.
    10:27:28 ARCGIS2@sgp >drop MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW";
    Materialized view dropped.
    10:27:31 ARCGIS2@sgp >alter MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW" compile;
    alter MATERIALIZED VIEW "ARCGIS"."GP_CP_P_VIEW" compile
    ERROR at line 1:
    ORA-12003: materialized view "ARCGIS"."GP_CP_P_VIEW" does not exist
    10:27:32 ARCGIS2@sgp >select count(*) from "ARCGIS"."GP_CP_P_VIEW";
    COUNT(*)
    0
    10:31:55 ARCGIS2@sgp >select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    PL/SQL Release 10.2.0.2.0 - Production
    CORE 10.2.0.2.0 Production
    TNS for Linux: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production

    Nope, drop table do not work. It told me that i must use drop materil.. view.
    I deleted two records from obj$ and restart database.
    An ugly solution for stupid dude ;(

  • Materialized Views created using ROLLUP

    Not sure if this one is best posted to a general Oracle forum, or even to the Discoverer Forum, but it's more to do with Data Warehousing so here goes...
    1. If I create a materialized view, either with or without OWB, do I also need to separately create indexes on the materialized view?
    2. If I create them using GROUP BY and ROLLUP (to create summaries that calculate all the subtotals along all hierarchies and dimensions), would any subsequent query have to use GROUP BY and ROLLUP to qualify for query rewrite?
    3. If I create them using GROUP BY and ROLLUP, would the queries generated by Discoverer ever get rewritten, as I assume they would not use GROUP BY and ROLLUP as these were not features found in earlier versions of Oracle?
    Any advice gratefully received.
    Mark

    Thanks for replying, Igor.
    Just to clarify:
    1. Do MV's created without fash refresh capabilities still get indexes created automatically? If not, should you manually create them in this instance?
    2. Can you confirm that, if a MV gets created using GROUP BY and ROLLUP (to potentially calculate all dimension intersections in one go), users queries to the base fact table do not have to use ROLLUP in their GROUP BY clause - they will still get rewritten ok?
    3. You mentioned that Discoverer generates queries using GROUP BY - does it ever use GROUP BY ROLLUP if it knows it's working on an Oracle 9i platform?
    I guess where i'm coming from, is that we're considering using the OLAP Summary Manager within OEM to create materialized views, rather than the normal summary adviser, as this creates MV's designed to hold (R)OLAP cubes (as detailed at http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/mv.htm#574241). I wouldn't however want to use these if user's queries had to specify ROLLUP in their GROUP by clause to qualify for query rewrite.
    Getting back to OWB, are there any plans to improve the support for importing, designing and refreshing materialized views in the Paris release of OWB? Summary management is perhaps a bit of a weak spot in OWB, and it'd be good if Hierarchical Cube Materialized Views - which are an excellent new feature in 9i - were supported in future releases.
    best regards
    Mark Rittman

  • Materialized Views from 9i to 10g

    Hi All
    I have read that Materialized views in oracle 9i or 10g does not differ alot and that in 10g the query_rewrite is compulsory... With this in mind I have done an import of full database from oracle 9i 9.2.0.1 to a database in 10g, 10.2.0.3. the import as such did not throw any messages..
    however, when I tried to re-import data schema wise from user1 in 9i to user1 in 10g, all the materialised views are failing to import data.. with ora-01732 error message.. where an update/insert is not allowed on views.. however, I expected tht once the import is complete, I could quickly recompile the views .. and restore the data. But when I try doing it.. .these tables in 10.2.0.3 database do not show up as snapshot tables which they are in source 9i..
    I tried to avoid importing these in my next attempt.. but no luck.. I am at the moment unsure if i am missing any thing on the target database which is 10g? Please advice.
    Sarat

    It is the same user who is doing both import as well as export... I create a full schema dmp file from the exp utility in 9i.. which is later imported as the same user into the schema in 10g for the data refresh..
    my exp and imp commands are as below..
    exp u1/u1 file=D:\Database\u01.dmp buffer=200000 compress=Y grants=y log=D:\Database\u01-emp.log STATISTICS=NONE
    imp file=e:\u01.dmp buffer=1073741824 statistics=none ignore=y resumable=y
    when prompted, supply u01 login credentials..
    the target machine has more cpu and ram and so the difference in buffer values..
    on source oracle is 9.2.0.1 and on target it is 10.2.0.3. I did not set any value for query rewrite or any additional parameter in the target.. as I read it is by default true.
    please advice.
    sarat

  • Materialized views - schedule, indexes, query rewrite, etc.

    I'm trying to get the hang of materialized views and need some help . . .
    running Oracle 10gR2
    I created a materialized view as follows:
    CREATE MATERIALIZED VIEW "MY_SCHEMA"."USERS"
    AS
    SELECT * FROM "USERS"@PRODUCTION -- to copy the USERS table from my production database to this database
    Worked fine. So far so good. Then, I altered it to schedule the refresh:
    ALTER MATERIALIZED VIEW "MY_SCHEMA"."USERS" REFRESH FORCE START WITH SYSDATE NEXT TRUNC(SYSDATE + 1) + 4/24
    -- to schedule a refresh immediately (SYSDATE) and every morning thereafter at 4:00 am (I think)
    then, I wanted to enable query rewrite, so I issued the following command:
    ALTER MATERIALIZED VIEW "MY_SCHEMA"."USERS" ENABLE QUERY REWRITE;
    and I got the
    ALTER MATERIALIZED VIEW succeeded.
    message for both of those commands (I'm doing this in SQL Developer).
    Then, I edit the materialized view in SQL Developer, click on the 'SQL' tab, and get the following:
    CREATE MATERIALIZED VIEW "MY_SCHEMA"."USERS"
    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 "TBLSPC_PHIGH"
    BUILD IMMEDIATE
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TBLSPC_PHIGH"
    REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT TRUNC(SYSDATE + 1) + 4/24
    WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS SELECT "USERS"."User" "User","USERS"."Logon" "Logon","USERS"."Name" "Name","USERS"."Password"
    "Password","USERS"."Level" "Level","USERS"."Producer" "Producer","USERS"."Deleted" "Deleted","USERS"."ClaimDoctor"
    "ClaimDoctor","USERS"."UserType" "UserType","USERS"."Locked" "Locked","USERS"."Scheduler"
    "Scheduler","USERS"."RestrictDays" "RestrictDays","USERS"."First" "First","USERS"."DisableAutoChart"
    "DisableAutoChart","USERS"."MaxChartOut" "MaxChartOut","USERS"."MaxHoursOut" "MaxHoursOut","USERS"."EffDate"
    "EffDate","USERS"."ExpDate" "ExpDate","USERS"."SwipeLogon" "SwipeLogon","USERS"."SwipePassword"
    "SwipePassword","USERS"."PwdLastChanged" "PwdLastChanged","USERS"."Audit" "Audit","USERS"."IsInstructor"
    "IsInstructor" FROM "USERS"@PRODUCTION.REGRESS.RDBMS.DEV.US.ORACLE.COM "USERS";
    The problems I've encountered so far:
    1) I created this two days ago and changed the value of one column in one row in the 'source' USERS table
    (USERS@PRODUCTION) as a test case. So far, that change has not propagated over to my materialized view even though
    it has had two chances to do so (yesterday morning at 4:00 am and this morning at 4:00 am).
    2) I enabled QUERY REWRITE. Why does it still show DISABLE?
    3) The primary key of the table came over (as far as I can tell) because it shows in SQL Developer. However, the
    indexed columns are no longer indexed. Do I need to recreate those indexes manually and will they persist?
    4) As you have guessed, I have just taken the plunge into materialized views, and have not been able to find
    anything on the Web along the lines of 'Materialized Views for Dummies'. So, any and all advice/suggestions/help
    will be welcome.
    Thanks,
    Carl

    The Refresh would be executed by a job submitted in the background.
    Query USER_JOBS (or DBA_JOBS) to see if a job has been submitted and if it has been running (you'd be able to see LAST_DATE, LAST_SEC and NEXT_DATE and NEXT_SEC). \
    If the Refresh job has been failing the FAILURES count would be incremented. If there are 16 consecutive failures, the job is marked BROKEN. (if a job fails, Oracle retries it automatically and keeps retrying till it is BROKEN). If the job has been failing you would get messages in the database instance alert log file and trace files.
    If the Refresh job has not been running check the parameter value for JOB_QUEUE_PROCESSES -- a value of 0 would not run in jobs in the USER_JOBS/DBA_JOBS view. Ask the DBA to increase set this parameter to at least 1.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Oracle - Query taking too long (Materialized view)

    Hi,
    I am extracting billing informaiton and storing in 3 different tables... in order to show total billing (80 to 90 columns, 1 million rows per month), I've used a materialized view... I do not have indexes on 3 billing tables - do have 3 indexes on Materialized view...
    at the moment it's taking too long to query the data (running a query via toad fails and shows "Out of Memory" error message; runing a query via APEX though is providing results but taking way too long)...
    Please advice how to make the query efficient...

    tparvaiz,
    Is it possible when building your materialized view to summarize and consolidate the data?
    Out of a million rows, what would your typical user do with that amount data if they could retrieve it readily? The answer to this question may indicate if and how to summarize the data within the materialized view.
    Jeff
    Edited by: jwellsnh on Mar 25, 2010 7:02 AM

  • Materialed View Refresh Error ORA-12008: error in materialized view refresh

    Hi,
    I am trying to refersh the following materialized view with the below command and getting the below error
    begin
    DBMS_MVIEW.REFRESH('GLVW_MIS_ADB');
    end;
    The following error has occurred:
    ORA-12008: error in materialized view refresh path
    ORA-12840: cannot access a remote table after parallel/insert direct load txn
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 803
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 860
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 841
    ORA-06512: at line 2
    Please advice on this.
    Thanks & Regards,
    Kartik

    $ oerr ora 12840
    12840, 00000, "cannot access a remote table after parallel/insert direct load txn"
    // *Cause: Within a transaction, an attempt was made to perform distributed
    // access after a PDML or insert direct  statement had been issued.
    // *Action: Commit/rollback the PDML transaction first, and then perform
    // the distributed access, or perform the distributed access before the
    // first PDML statement in the transaction.
    $                                                                   

  • Error: ORA-12008: error in materialized view refresh path

    Hello Dba' s
    We are on 12.0.6 EBS with 10.2.0.5 DB on Sun solaris SPARC 64 bit.
    We are getting below error while Refreshing Materialized View.
    Start of log messages from FND_FILE
    Error: ORA-12008: error in materialized view refresh path
    ORA-00600: internal error code, arguments: [kcblasm_1], [103], [], [], [], [], [], [] Occured while Refreshing Materialized View
    End of log messages from FND_FILE
    Not sure how to proceed.We have just upgraded our database from 10.2.0.3 to 10.2.0.5.
    Also we still have our test instance with 10.2.0.3 database ,there refreshing MV completed successfully.
    Also refreshing through TOAD gives below error:-
    BEGIN
    DBMS_SNAPSHOT.REFRESH(
    LIST => 'XXPPL.XXPPL_OPM_TRANSACTIONS_MV'
    ,PUSH_DEFERRED_RPC => TRUE
    ,REFRESH_AFTER_ERRORS => FALSE
    ,PURGE_OPTION => 1
    ,PARALLELISM => 0
    ,ATOMIC_REFRESH => TRUE
    ,NESTED => FALSE);
    END;
    Error at line 2
    ORA-12008: error in materialized view refresh path
    ORA-00600: internal error code, arguments: [kcblasm_1], [103], [], [], [], [], [], []
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2256
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2462
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2431
    ORA-06512: at line 2
    Please advice.
    Thanks,
    Edited by: user12209274 on Nov 23, 2010 2:10 AM

    thank you Justin,
    I found in my alertDB.log this line ;
    Mon Aug 20 03:00:54 2007
    ORA-01555 caused by SQL statement below (SQL ID: 64a7sdbbvknta, Query Duration=1021 sec, SCN: 0x0004.4a145344):
    Mon Aug 20 03:00:54 2007
    INSERT /*+ BYPASS_RECURSIVE_CHECK */ INTO "MANAGEMENT"."MVIEW_COMPUTERS"("ID","WINVERSION","ANTIVIRUS","GUID","INSTALLDT","CONNECTION_TYPE","GROUPID
    ","QUOVACOUNTRY") SELECT "C"."ID","C"."WINVERSION","C"."ANTIVIRUS","C"."GUID","C"."INSTALLDT","C"."CONNECTIONTYPE","C"."GROUPID","C"."QUOVACOUNTRY"
    FROM "MANAGEMENT"."COMPUTERS" "C"
    So i execute this query to found the TUNED_UNDORETENTION value ;
    SELECT *
    FROM V$UNDOSTAT v
    WHERE v.MAXQUERYID = '64a7sdbbvknta'
    and i have this result :
    BEGIN_TIME     20070820 02:53:42
    END_TIME     20070820 03:03:42
    UNDOTSN     1
    UNDOBLKS     51242
    TXNCOUNT     5012
    MAXQUERYLEN     1060
    MAXQUERYID     64a7sdbbvknta
    MAXCONCURRENCY     21
    UNXPSTEALCNT     0
    UNXPBLKRELCNT     0
    UNXPBLKREUCNT     0
    EXPSTEALCNT     14
    EXPBLKRELCNT     51392
    EXPBLKREUCNT     0
    SSOLDERRCNT     1
    NOSPACEERRCNT     0
    ACTIVEBLKS     606920
    UNEXPIREDBLKS     19896
    EXPIREDBLKS     612728
    TUNED_UNDORETENTION     1841
    I don't know exactly which value i should set my parameter?
    Message was edited by:
    HAGGAR

  • Query can't be rewritten by a Materialized View

    Hi All,
    The structure of Materialized view looks like:
    select
    T1483342.MEASR_AMT as c4,
    T1482315.MTH_NAME as c8
    from
    MMM T1483380,
    AN_VSBL_IND_LKP T1483226,
    AMM T1484452 ,
    ND_ASDN_DIM T1483850,
    _FDIM                                    T1482018,
    R_DIM T1482315,
    AN_FCT T1483342
    where (JOINS)
    And it has 'ENABLE QUERY REWRITE' clause.
    If I run the query like this, the query rewritten is used by CBO and seems fine to me.
    select
    T1483342.MEASR_AMT as c4,
    T1482315.MTH_NAME as c8
    from
    MMM T1483380,
    AN_VSBL_IND_LKP T1483226,
    AMM T1484452 ,
    ND_ASDN_DIM T1483850,
    _FDIM                                   T1482018,
    R_DIM T1482315,
    AN_FCT T1483342
    where (JOINS)
    But if I run the query like the following one, query rewritten can't happen with the following reason:
    QSM-01072: materialized view, LEON_SVP_NEW1, and query have different joins between tables.
    select
    sum(T1483342.MEASR_AMT) as c4,
    T1482315.MTH_NAME as c8
    from
    MMM T1483380,
    AN_VSBL_IND_LKP T1483226,
    AMM T1484452 ,
    ND_ASDN_DIM T1483850,
    _FDIM                                          T1482018,
    R_DIM T1482315,
    AN_FCT T1483342
    where (JOINS)
    group by T1482315.MTH_NAME
    order by c8
    The only difference between the 2 query is one has aggregation on one column but the other does not.
    Can someone give me some advice on why the latter query is not rewritten by CBO, please?
    Thank you very much,
    Leon
    Edited by: user12064076 on Feb 15, 2011 7:22 PM

    The error message is
    QSM-01072: materialized view, string, and query have different joins between tables, string
    Cause: Anchors, if any, in the MV and query match. But the joins between these anchors in the MV and query are different.
    Action: None
    That would mean that the JOINs are different.
    Edited by: Hemant K Chitale on Feb 16, 2011 11:34 AM
    Edited by: Hemant K Chitale on Feb 16, 2011 11:34 AM

  • Materialized View Refresh issue

    Hi
    I created a mv with refresh on demand then created log on it then created aother mv using the 1st mv.
    Did the the fast refresh on the 1st view that works fine then I did the fast refresh on the child mv its failing with the following error
    ORA-12034: materialized view log on VIEW1 younger than last refresh
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 803
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 860
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 841
    ORA-06512: at line 1
    Any clues........

    Any advice Please

  • Materialized views with Complete refresh taking infinite time while refresh

    Hi,
    We have some materialized view which are configured for Complete refresh and are being refreshed manually everyday in the morning. Some times we face this issue of the MV taking longer time than usual for refresh. We tried running the below query to see if any object/MVs are locked and did not obtain any entries using the query:
    SELECT username U_NAME, owner OBJ_OWNER,
    object_name, object_type, s.osuser,
    DECODE(l.block,
    0, 'Not Blocking',
    1, 'Blocking',
    2, 'Global') STATUS,
    DECODE(v.locked_mode,
    0, 'None',
    1, 'Null',
    2, 'Row-S (SS)',
    3, 'Row-X (SX)',
    4, 'Share',
    5, 'S/Row-X (SSX)',
    6, 'Exclusive', TO_CHAR(lmode)
    ) MODE_HELD
    FROM gv$locked_object v, dba_objects d,
    gv$lock l, gv$session s
    WHERE v.object_id = d.object_id
    AND (v.object_id = l.id1)
    AND v.session_id = s.sid
    ORDER BY username, session_id;
    Hence please help us in troubleshooting this issue in Refreshing. and also let us know of any possible cause of Refresh taking longer time than usual.
    Thanking you in advance.
    Bharath

    >
    We have some materialized view which are configured for Complete refresh and are being refreshed manually everyday in the morning. Some times we face this issue of the MV taking longer time than usual for refresh
    >
    Which is it? 'some' MVs or 'the' MV that is taking longer than usual.
    1. How many MVs are being refreshed?
    2. What process are you using to refresh them
    3. Are you refreshing them one at a time serially or just starting the refresh of all of them at the same time?
    4. Do any of these MVs use the same base tables as the other MVs
    5. Are any of the MVs based on remote tables?
    6. Are any of the MVs based on other MVs?
    7. What does an AWR report show for the time period when things are taking longer than usual?
    All of the same issues that can cause a query to run slow can cause an MV refresh to go slow because an MV refresh is a query.
    But you need to provide a lot more information and metrics about your system if you want to get any advice that might be specific to your particular case.

Maybe you are looking for

  • Data plugin to append to channels in different channel groups

    Hello I try to import particel counter data from a text file which is organized in a difficult way: Data come in blocks with each block taken at one time. Each block consists of a table of tab-separated data. e.g. (start of Block 1) 04.06.2013 - 16:3

  • Spry data set not displaying in IE8

    Hi, I have inserted a spry data set based on an HTML table onto my page. The data displays in live view and in Safari, but when I try to preview in IE8 I get nothing. Here's the page: http://www.emiliocorsetti.com/publish/maps.html Any ideas? I didn'

  • Submit button issue

    I created a static form in LiveCycle. Then, in order enable the reader rights and allow users to add attachments in the comments, I opened it in Acrobat Pro and enabled the rights and distributed it. But, when it's posted on the intranet, the user se

  • PO Tax

    Hi All, In the Intercompany sale, the tax code in PO will be different and when you create intercompany billing, the system will pick up the tax code of the goods sending country , if the system picks up the tax code from the billing doc., then why d

  • Scanned doc to PDF format

    How can I set my Canon PIXMA MX459 to automatically set scanned documents in PDF format?