Materialized View Issue

Hi,
I have created a materialized view , which is refreshed every day at 1 AM . It was created yesterday. Here is the initial part of it
CREATE MATERIALIZED VIEW MV_TEST
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 2
MAXTRANS 255
NOCACHE
NOLOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
REFRESH COMPLETE
START WITH SYSDATE
NEXT ROUND(SYSDATE + 1) + 1/24
WITH PRIMARY KEY
AS
Now , when it was created initially , a query that retrieves around 40,000 records took 8 seconds to run . That looked ok . But today when I tried to run the same query , it took 12 minutes to runt he query . Any idea whats going wrong . I checked the user jobs , it says its a non broken job ,means completed successfully . Please, if you can have some suggestions , what to do or what to check to see whats is going on .
Thanks .

here is the query with its execution plan
SELECT  PERSONNEL_ID, EMP_FIRST_NAME, EMP_LAST_NAME, EXEMPT, FTE_ASSIGNED, EMPLOYEE_VISITOR_ID, STAFF_CATEGORY, EMP_DIVISION, ACCOUNT_ID, ACCOUNT_NUMBER, ACCOUNT_NAME,
        ACCOUNT_MANAGER_ID, ACCOUNT_START_DATE, ACCOUNT_END_DATE, ACCOUNT_STATUS, MGR_FIRST_NAME, MGR_LAST_NAME, MGR_DIVISION, YEARS, PERIOD_YEAR, LCS_EFFORT
FROM
WITH
LCS AS (SELECT LC.PERSONNEL_ID, LC.ACCOUNT_ID , SUM(NVL(LC.LCS_EFFORT,0)) LCS_EFFORT , AP.PERIOD_YEAR
        FROM
        (SELECT PERSONNEL_ID, ACCOUNT_ID , FISCAL_YEAR_ID , FISCAL_PERIOD_ID , LCS_EFFORT
        FROM LABOR_COMMITED WHERE COMMITED_DATE IS NOT NULL ) LC
        PARTITION BY ( PERSONNEL_ID, ACCOUNT_ID)
        RIGHT OUTER JOIN
        (SELECT FIRST_DAY PERIOD_YEAR, FISCAL_YEAR_ID, FISCAL_SYSTEM_PERIOD_ID FROM ALL_PERIODS WHERE CALENDRICAL_EQUIVALENT IS NOT NULL
         AND FIRST_DAY > TO_DATE('01-JUN-2004','DD-MON-YYYY')) AP
        ON (LC.FISCAL_YEAR_ID = AP.FISCAL_YEAR_ID  AND LC.FISCAL_PERIOD_ID = AP.FISCAL_SYSTEM_PERIOD_ID)
        GROUP BY LC.PERSONNEL_ID, LC.ACCOUNT_ID , AP.PERIOD_YEAR),
PER AS (SELECT P.PERSONNEL_ID, P.FIRST_NAME EMP_FIRST_NAME, P.SURNAME_ISI EMP_LAST_NAME, P.EXEMPT, P.FTE_ASSIGNED,
        NVL(P.EMPLOYEE_ID,P.VISITOR_NUMBER) EMPLOYEE_VISITOR_ID, ST.CODE_VALUE STAFF_CATEGORY, DIV.DIVISION_NUMBER EMP_DIVISION
        FROM PERSONNEL P , CODES ST , DIVISIONS DIV 
        WHERE P.STAFF_CATEGORY_CODE_ID  = ST.CODE_ID (+) AND P.DIVISION_ID = DIV.DIVISION_ID (+)),
ACT AS (SELECT AC.ACCOUNT_ID, AC.ACCOUNT_NUMBER, AC.ACCOUNT_NAME, AC.ACCOUNT_MANAGER ACCOUNT_MANAGER_ID, AC.ACCOUNT_START_DATE, AC.ACCOUNT_END_DATE,
        ACS.ACCOUNT_STATUS_DESIG ACCOUNT_STATUS, MGR.FIRST_NAME MGR_FIRST_NAME, MGR.SURNAME_ISI MGR_LAST_NAME,  MGR_DIV.DIVISION_NUMBER MGR_DIVISION
        FROM ACCOUNTS AC, ACCOUNT_STATUS ACS, PERSONNEL MGR, DIVISIONS MGR_DIV
        WHERE AC.ACCOUNT_STATUS_ID = ACS.ACCOUNT_STATUS_ID AND AC.ACCOUNT_MANAGER = MGR.PERSONNEL_ID AND MGR.DIVISION_ID = MGR_DIV.DIVISION_ID (+))
SELECT  PER.PERSONNEL_ID , PER.EMP_FIRST_NAME, PER.EMP_LAST_NAME, PER.EXEMPT, PER.FTE_ASSIGNED, PER.EMPLOYEE_VISITOR_ID, PER.STAFF_CATEGORY , PER.EMP_DIVISION,
        ACT.ACCOUNT_ID, ACT.ACCOUNT_NUMBER, ACT.ACCOUNT_NAME, ACT.ACCOUNT_MANAGER_ID, ACT.ACCOUNT_START_DATE, ACT.ACCOUNT_END_DATE, ACT.ACCOUNT_STATUS,
        ACT.MGR_FIRST_NAME, ACT.MGR_LAST_NAME, ACT.MGR_DIVISION, TO_NUMBER(TO_CHAR(LCS.PERIOD_YEAR,'YYYY')) YEARS, LCS.PERIOD_YEAR, LCS.LCS_EFFORT
FROM    LCS, PER, ACT
WHERE   LCS.PERSONNEL_ID = PER.PERSONNEL_ID
AND     LCS.ACCOUNT_ID = ACT.ACCOUNT_ID
PLAN_TABLE_OUTPUT
Plan hash value: 2443154823
| Id  | Operation                          | Name                  | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                   |                       |   190K|   278M|       | 41814   (1)| 00:08:22 |
|   1 |  VIEW                              |                       |   190K|   278M|       | 41814   (1)| 00:08:22 |
|*  2 |   HASH JOIN RIGHT OUTER            |                       |   190K|    39M|       | 41814   (1)| 00:08:22 |
|   3 |    TABLE ACCESS FULL               | CODES                 |  4513 | 58669 |       |     8   (0)| 00:00:01 |
|*  4 |    HASH JOIN RIGHT OUTER           |                       |   190K|    36M|       | 41802   (1)| 00:08:22 |
|   5 |     TABLE ACCESS FULL              | DIVISIONS             |    11 |    77 |       |     3   (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|*  6 |     HASH JOIN                      |                       |   190K|    35M|       | 41795   (1)| 00:08:22 |
|   7 |      TABLE ACCESS FULL             | PERSONNEL             |  2100 | 90300 |       |    25   (4)| 00:00:01 |
|*  8 |      HASH JOIN                     |                       |   190K|    27M|       | 41766   (1)| 00:08:22 |
|*  9 |       HASH JOIN                    |                       |  2449 |   253K|       |    42   (8)| 00:00:01 |
|  10 |        TABLE ACCESS FULL           | ACCOUNT_STATUS        |     2 |    10 |       |     3   (0)| 00:00:01 |
|* 11 |        HASH JOIN                   |                       |  2449 |   241K|       |    38   (6)| 00:00:01 |
|* 12 |         HASH JOIN RIGHT OUTER      |                       |  2100 | 69300 |       |    28   (4)| 00:00:01 |
|  13 |          TABLE ACCESS FULL         | DIVISIONS             |    11 |    77 |       |     3   (0)| 00:00:01 |
|  14 |          TABLE ACCESS FULL         | PERSONNEL             |  2100 | 54600 |       |    25   (4)| 00:00:01 |
|  15 |         TABLE ACCESS FULL          | ACCOUNTS              |  2449 |   162K|       |     9   (0)| 00:00:01 |
|  16 |       VIEW                         |                       |   190K|  8906K|       | 41720   (1)| 00:08:21 |
PLAN_TABLE_OUTPUT
|  17 |        HASH GROUP BY               |                       |   190K|    12M|    32M| 41720   (1)| 00:08:21 |
|  18 |         VIEW                       |                       |   190K|    12M|       | 38561   (1)| 00:07:43 |
|  19 |          MERGE JOIN PARTITION OUTER|                       |   190K|    10M|       | 38561   (1)| 00:07:43 |
|  20 |           SORT JOIN                |                       |     5 |    95 |       |    14   (8)| 00:00:01 |
|  21 |            VIEW                    |                       |     5 |    95 |       |    13   (0)| 00:00:01 |
|  22 |             NESTED LOOPS           |                       |     5 |    90 |       |    13   (0)| 00:00:01 |
|  23 |              TABLE ACCESS FULL     | FISCAL_YEARS          |     8 |    80 |       |     3   (0)| 00:00:01 |
|* 24 |              TABLE ACCESS FULL     | FISCAL_SYSTEM_PERIODS |     1 |     8 |       |     1   (0)| 00:00:01 |
|* 25 |           SORT PARTITION JOIN      |                       | 38000 |  1447K|  4216K|   532   (3)| 00:00:07 |
|  26 |            VIEW                    |                       | 38000 |  1447K|       |   142   (3)| 00:00:02 |
|* 27 |             TABLE ACCESS FULL      | LABOR_COMMITED        | 38000 |  1447K|       |   142   (3)| 00:00:02 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
   2 - access("P"."STAFF_CATEGORY_CODE_ID"="ST"."CODE_ID"(+))
   4 - access("P"."DIVISION_ID"="DIV"."DIVISION_ID"(+))
   6 - access("LCS"."PERSONNEL_ID"="P"."PERSONNEL_ID")
   8 - access("LCS"."ACCOUNT_ID"="AC"."ACCOUNT_ID")
   9 - access("AC"."ACCOUNT_STATUS_ID"="ACS"."ACCOUNT_STATUS_ID")
  11 - access("AC"."ACCOUNT_MANAGER"="MGR"."PERSONNEL_ID")
PLAN_TABLE_OUTPUT
  12 - access("MGR"."DIVISION_ID"="MGR_DIV"."DIVISION_ID"(+))
  24 - filter("PERIODS"."CALENDRICAL_EQUIVALENT" IS NOT NULL AND CASE  WHEN
              "PERIODS"."CALENDRICAL_EQUIVALENT" IS NOT NULL THEN TO_DATE(''||TO_CHAR("PERIODS"."CALENDRICAL_EQUIVALENT")|
              |'/01/'||"YEARS"."FISCAL_YEAR"||'','MM/DD/YYYY') ELSE
              TO_DATE('06/01/'||"YEARS"."FISCAL_YEAR"||'','MM/DD/YYYY')+14 END >TO_DATE('2004-06-01 00:00:00',
              'yyyy-mm-dd hh24:mi:ss'))
  25 - access("LC"."FISCAL_YEAR_ID"="AP"."FISCAL_YEAR_ID" AND
              "LC"."FISCAL_PERIOD_ID"="AP"."FISCAL_SYSTEM_PERIOD_ID")
       filter("LC"."FISCAL_PERIOD_ID"="AP"."FISCAL_SYSTEM_PERIOD_ID" AND
              "LC"."FISCAL_YEAR_ID"="AP"."FISCAL_YEAR_ID")
  27 - filter("COMMITED_DATE" IS NOT NULL)
55 rows selected.

Similar Messages

  • Materialized view issue with spatial index and UNION all.

    Hi guys,
    I'm trying to build the following materialized view:
    create materialized VIEW MV_ElectricalStuffs
      refresh fast
      AS
      SELECT jb.ROWID,
        jb.FID,
        JB.NAME_NUMBER
      FROM EL_BUS_BAR jb
      UNION ALL
      SELECT INC.ROWID,
        INC.FID,
        NULL,
        INC.NAME_NUMBER
      FROM EL_INTERNAL_CELL INC;
    I have this error showing up:
    ORA-12015: cannot create a fast refresh materialized view from a complex query
    This is because the table EL_INTERNAL_CELL has a SDO_GEOMETRY column that has a spatial index, whose ddl is
    CREATE INDEX EL_INTERNAL_CELL_S ON EL_INTERNAL_CELL (GEOM) INDEXTYPE IS MDSYS.SPATIAL_INDEX
    PARAMETERS('SDO_INDX_DIMS=2 TABLESPACE=USERS LAYER_GTYPE=COLLECTION');
    When I remove the spatial index from EL_INTERNAL_CELL column GEOM, Oracle is very happy and creates the view.
    Is there a mean however to keep the spatial index in the materialized view?

    I've managed to drop the spatial index prior to create the materialized view and it is ok. After the materialized view creation, I've recreated the spatial index on the table and all ran smooth. Hope nothing will go bad in the future because of this trick on spatial index..

  • Materialized view issue ORA-12052

    Hi All,
    I'm currently trying to create a MV using Fast refresh method.
    and I'm getting the following error:
    ORA-12052:
    cannot fast refresh materialized view string.string
    Cause: Either ROWIDs of certain tables were missing in the definition or the inner table of an outer join did not have UNIQUE constraints on join columns.
    Action: Specify the FORCE or COMPLETE option. If this error is got during creation, the materialized view definition may have be changed. Refer to the documentation on materialized views.
    I'm trying to create the Unique constraints required. Could anybody help me with this?. Which are the "inner tables of an outer join"?
    I have also created the MVs logs with rowid, but also nothing happend.
    I' ve created a Unique constraint that includes all the fields of the ourter joins. Nothing happend either.
    Thi is the MV script:
    'CREATE MATERIALIZED VIEW MVIEW1
    USING INDEX
    REFRESH ON DEMAND FAST
    WITH rowid
    DISABLE QUERY REWRITE AS
    SELECT fp.FINAL_AMOUNTFIXED,
    fp.FINAL_FPRATE,
    fp.updated_rate,
    fp.gsd_rate,
    fp.nongsd_rate,
    fp.AMT_CD,
    fp.AMT_CD_ADJ1,
    fp.AMT_CD_ADJ2,
    fp.AMT_LC,
    fp.AMT_LC_ADJ1,
    fp.AMT_LC_ADJ2,
    fp.ASSIGNMENT_STATUS,
    fp.CURRENCY,
    fp.DOLLARS,
    fp.FORECAST_REVENUE_STATUS,
    fp.GUID,
    NVL(fp.HOURS,0) HOURS,
    fp.ID,
    fp.JOB_LEVEL,
    fp.PJR_AMT_CD,
    fp.PJR_HOURS_VALUE,
    fp.PJR_LC,
    fp.PJR_RATE,
    fp.PJR_RATE_VALUE,
    fp.PROJECT_COST_CENTER,
    fp.PROJECT_COST_CENTERTXT,
    NVL(cust.project_manager,fp.project_manager) project_manager,
    NVL(cust.project_name,fp.project_name) project_name,
    fp.PROJECT_NUMBER,
    fp.PROJECT_ORGANIZATION,
    NVL(cust.project_status,fp.project_status) project_status,
    NVL(cust.project_type,fp.project_type) project_type,
    NVL(fp.RATE,0) Rate,
    fp.RATE_ADJ1,
    fp.RATE_ADJ2,
    fp.RATE_LEVEL,
    fp.REPORT_DATE_ID,
    fp.REPORT_DESCRIPTION,
    fp.RESOURCE_COST_CENTER,
    fp.RESOURCE_COST_CENTERTXT,
    fp.RESOURCE_COUNTRY,
    fp.RESOURCE_NAME,
    fp.RESOURCE_ORGANIZATION,
    fp.RESOURCE_TYPE,
    fp.REVENUECOST_TYPE,
    fp.ROLE_END_DATE,
    fp.ROLE_NAME,
    fp.ROLE_START_DATE,
    fp.TAB,
    fp.TASK_NUMBER,
    fp.TPRATE_TP,
    fp.WAR,
    fp.WE_DATE_ID,
    fp.WEEK,
    fp.WORK_TYPE,
    fp.PJR_FF_DIFF_MONTH,
    fp.PJR_FF_DIFF_QTR,
    NVL(fp.PJR_WOW,0) WOW,
    fp.PJR_WOW_HRS,
    fp.REMOVED_BY_ADJUSTMENT,
    fp.PICK_FOR_WRITEBACK,
    fp.DRAFT_REV_NUM,
    fp.DRAFT_INV_NUM,
    NVL(pca.country,fp.PROJECT_COUNTRY) Country,
    NVL(cust.customer_id,NVL(fp.CUSTOMER_NUMBER,'TBD')) Customer_ID,
    NVL(cust.CUSTOMER_NAME,NVL(fp.CUSTOMER_NAME,'TBD')) Customer_Name ,
    fp.ITEM_DATE,
    fp.REVENUE_CC,
    fp.EXPLANATION,
    fp.REPORT,
    fp.REPORT_ADJUSTMENT,
    fp.REPORT_ADJ1,
    fp.REPORT_ADJ2,
    fp.JE_DESCRIPTION,
    pca.REGION_HQ_TIERLAST_CODE,
    pca.MANAGER_FIELD_TIERLAST_CODE,
    pca.SPECIALTY_HQ_TIERLAST_CODE,
    pca.SECTOR_HQ_TIERLAST_CODE,
    rca.REGION_HQ_TIERLAST_CODE,
    rca.MANAGER_FIELD_TIERLAST_CODE,
    rca.SPECIALTY_HQ_TIERLAST_CODE,
    rca.SECTOR_HQ_TIERLAST_CODE,
    pca.VERTICALS_SUB_LOB,
    pca.MISC_GROUP ,
    rca.VERTICALS_SUB_LOB,
    rca.MISC_GROUP ,
    fp.gl_date,
    fp.pjr_wow_rate ,
    fp.created_by,
    fp.created_on,
    NVL(fp.TOTAL_FUNDING,0) TOTAL_FUNDING,
    NVL(fp.INCEPTION_TO_BURN,0) INCEPTION_TO_BURN,
    NVL(fp.AVAILABLE_FUNDING,0) AVAILABLE_FUNDING,
    NVL(fp.FORECAST_AMT,0) FORECAST_AMT,
    cust.pop_date,
    fp.COMMENTS_WOW_PROJ,
    fp.COMMENTS_PAPER_CONFIRM,
    rep.LOOKUP_CODE,
    rep.NAC_SORTING1,
    fp.ACTION_TO_CLOSE,
    NVL(fp.NEGATIVE_BACKLOG,0) NEGATIVE_BACKLOG,
    fp.SALES_REP,
    fp.FORECAST_DATE,
    pca.NAC_RES_TYPE_3,
    rca.NAC_RES_TYPE_3
    FROM FACT_PJR fp,
    COSTCENTER_ATTRIBUTES pca ,
    COSTCENTER_ATTRIBUTES rca,
    wb_customer_lookups cust,
    XXAPX_LOOKUPS rep
    WHERE fp.revenue_cc = pca.LEAF_CC(+)
    AND fp.RESOURCE_COST_CENTER = rca.LEAF_CC(+)
    AND fp.project_number = cust.project_number(+)
    AND fp.REPORT_ADJ2 = rep.VALUE(+)
    AND rep.LOOKUP_TYPE = 'NAC_WB_PHASE2';'
    Edited by: 859267 on May 3, 2012 11:51 AM

    Please edit your post and surround the code with code tags. See 'Are there any useful formatting options not shown on the sidebar?' in the FAQ.
    Also provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).

  • Issue with creation of a materialized view

    Hi,
    I have a SQL query that works fine.
    But when I create a materialized view using the query, a few columns in the MV do not get populated at all.
    What could be the issue here?
    regards
    Prem

    Hi,
    Thanks for the reply. Here is the code.
    CREATE MATERIALIZED VIEW EDW.MV_OPPTY_ACTIVITY_AGG
    TABLESPACE EDW_DIM_DAT
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    WITH PRIMARY KEY
    AS
    select
    OPPTY_ID OPPTY_ID,
    OPPORTUNITY_KEY OPPORTUNITY_KEY,
    oppty_number oppty_number ,
    SALES_CONSULTANT_HIST_KEY SALES_CONSULTANT_HIST_KEY ,
    company_add_source_key company_add_source_key,
    SALES_CONSULTANT_ID SALES_CONSULTANT_ID,
    ACTIVITY_TYPE ACTIVITY_TYPE ,
    activity_DATE activity_DATE ,
    LAST_MODIFIED_DATE LAST_MODIFIED_DATE ,
    CUSTOMER_FLAG CUSTOMER_FLAG,
    SALES_EMPLOYEE_HIST_KEY,
    milestone_KEY,
    oppty_milestone_name_hist stage_name,
    oppty_milestone_id_hist stage_id,
    milestone_prob prob_to_close,
    start_date oppty_start_date,
    oppty_close_date oppty_close_date,
    end_date oppty_end_date,
    sum(DURATION) TOTAL_DURATION,
    sum (CASE WHEN ACTIVITY_type IN ('CU14', 'CU15', 'CU16', 'CU17',
    'CU18', 'CU19', 'CU20', 'CU21') THEN DURATION ELSE 0 END ) CQM_DURATION,
    sum (CASE WHEN ACTIVITY_type = 'CU01' THEN DURATION ELSE 0 END ) TRADE_SEM_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU02' THEN DURATION ELSE 0 END ) RFP_RFI_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU03' THEN DURATION ELSE 0 END ) INFO_GATH_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU04' THEN DURATION ELSE 0 END ) PREP_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU05' THEN DURATION ELSE 0 END ) PRES_DEMO_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU06' THEN DURATION ELSE 0 END ) POC_DURATION,
    sum ( CASE WHEN ACTIVITY_type = 'CU07' THEN DURATION ELSE 0 END ) PRE_CUST_SUPP_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU08' THEN DURATION ELSE 0 END ) POST_CUST_SUPP_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU09' THEN DURATION ELSE 0 END ) PARTNER_SUPP_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU10' THEN DURATION ELSE 0 END ) TRAVEL_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU11' THEN DURATION ELSE 0 END ) KEYCODES_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU12' THEN DURATION ELSE 0 END ) SI_SUPP_DURATION,
    sum ( CASE WHEN ACTIVITY_type = 'CU13' THEN DURATION ELSE 0 END ) CHANNEL_SUPP_DURATION,
    sum( CASE WHEN ACTIVITY_type = 'CU23' THEN DURATION ELSE 0 END ) MIGRATION_DURATION ,
    max(LICENSE_USD) LICENSE_USD ,
    MAX(LICENSE_LOCAL) LICENSE_LOCAL,
    MAX(maintAINANCE_usd) maintAINANCE_usd,
    MAX(maintAINANCE_LOCAL) maintAINANCE_LOCAL,
    MAX(TRAINING_USD) training_usd,
    MAX(TRAINING_LOCAL) training_LOCAL,
    MAX(CONSULTING_USD) consulting_usd,
    MAX(CONSULTING_LOCAL) consulting_LOCAL,
    MAX(RENEWALS_USD) renewals_usd ,
    MAX(RENEWAL_local) RENEWAL_local,
    max(LOBANALYTICS2_LOCAL) epm_local,
    max(LOBDATAINTEGRATION2_LOCAL) eim_local,
    max(IDD_AMOUNT_LOCAL) idd_local,
    max(ONDEMAND_AMOUNT_LOCAL) ondemand_local,
    max(LOBANALYTICS2_usd) epm_usd,
    max(LOBDATAINTEGRATION2_usd) eim_usd,
    max(IDD_AMOUNT_usd) idd_usd,
    max(ONDEMAND_AMOUNT_usd) ondemand_usd
    FROM edw.sales_consulting_activity_fct t1 ,
    select
    o.oppty_id_number,
    o.oppty_id,
    O.OPPORTUNITY_KEY,
    LICENSE_USD LICENSE_USD ,
    LICENSE_LOCAL LICENSE_LOCAL,
    o.FYM_USD maintAINANCE_usd,
    o.FYM_LOCAL maintAINANCE_LOCAL,
    o.TRAINING_USD training_usd,
    o.TRAINING_LOCAL training_LOCAL,
    o.CONSULTING_USD consulting_usd,
    o.CONSULTING_LOCAL consulting_LOCAL,
    o.RENEWAL_USD renewals_usd ,
    o.RENEWAL_local RENEWAL_local ,
    o.LOBANALYTICS2_LOCAL,
    o.LOBANALYTICS2_usd,
    o.LOBDATAINTEGRATION2_LOCAL,
    o.IDD_AMOUNT_LOCAL,
    o.ONDEMAND_AMOUNT_LOCAL,
    o.LOBDATAINTEGRATION2_usd,
    o.IDD_AMOUNT_usd,
    o.ONDEMAND_AMOUNT_usd
    from edw.opportunity_hist_fact o
    where o.SOURCE_SYSTEM='SFDC'
    and upper(status)='ACTIVE'
    and o.last_modified_date = (select max(last_modified_date )from edw.opportunity_hist_fact o2 where o.opportunity_key = o2.opportunity_key))T2,
    ( Select activity_key,OPPTY_ID_NUMBER, MIL.milestone_KEY,MIL.milestone_name oppty_milestone_name_hist,milestone_id
    oppty_milestone_id_hist, milestone_prob,start_date,oppty_close_date,end_date FROM
    EDW.opportunity_hist_fact OPP,
    edw.milestone MIL,
    edw.sales_consulting_activity_fct act WHERE
    ACTIVITY_DATE >=start_date (+) and activity_date <=opp.last_modified_date(+)
    and OPP.OPPTY_ID_NUMBER (+) =act.OPPTY_NUMBER
    and OPP.milestone_key =MIL.milestone_key(+) ) T3
    where t1.oppty_NUMBER (+) =T2.OPPTY_ID_NUMBER
    and t1.activity_key=t3.activity_key
    --and oppty_number ='279749'
    GROUP BY OPPTY_ID,
    oppty_number,
    OPPORTUNITY_KEY,
    SALES_CONSULTANT_HIST_KEY ,
    company_add_source_key,
    SALES_CONSULTANT_ID,
    SALES_EMPLOYEE_HIST_KEY,
    ACTIVITY_TYPE ,
    ACTIVITY_DATE ,
    LAST_MODIFIED_DATE,
    CUSTOMER_FLAG,
    milestone_KEY,
    oppty_milestone_name_hist,
    oppty_milestone_id_hist,
    milestone_prob,
    start_date,
    oppty_close_date,
    end_date;
    Regards,
    Prem

  • Issue with complete refresh on materialized view when using rownum

    Hi all,
    I had an issue with rownum when using complete refresh
    I am using rownum when creating materialized view and it is generation correctly.But the issue was when i am refreshing the same ,rownum was not getting sorted in ascending order.
    anyone had come across this scenario

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

  • Issue in Materialized view

    Hi,
    Am facing the below issue while creating MV,
    create materialized view log on a;
    cretae materialized view log ob b;
    create materialized view
    refresh fast on commit
    as
    select a.x,a.y,b.z
    from a,b
    where
    a.i=b.i and
    a.bill_dt > trunc(add_months(sysdate,-12),'month');
    And am getting ORA-12054 Kindly suggest me how can achive this?
    Thanks,
    Siva

    I don't really have a good idea, sorry.
    If an MV can be partitioned, then maybe monthly partitioning on the MV could be an option. But I guess (I do not know for certain) that an MV would not support dropping old partions.
    An alternative solution (but it is somewhat a kludge) would be an MV that refreshes complete every night (no refresh fast on commit, no MV logs.) Then you create a view that selects from the MV all data before today and uses union all to a select that queries the base tables for todays data. It will not be as fast to query as an MV refresh on commit, but it might be fast enough?
    I do not see another way - but maybe some other forum user has a good idea? ;-)

  • Materialized view logs issue

    We are having issues with the size of materialized view logs in one od the database. The size of the log table is around 32G. Will appreciate if somebody will help in explaining why it is having such a huge size and is not getting purged.
    At the same time the master table is having comparatively smaller size of 18G(did not check table fragmentation).
    Also, please help me in understanding what is required to be done for fixing this issue.
    SQL> select LOG_OWNER,MASTER,LOG_TABLE,LOG_TRIGGER,PRIMARY_KEY from dba_mview_logs where log_owner='MARTDATA' and MASTER='POLICY_CONFIGURATION';
    LOG_OWNER MASTER LOG_TABLE LOG_TRIGGER PRI
    MARTDATA POLICY_CONFIGURATION MLOG$_POLICY_CONFIGURATION NO
    SQL> select owner, segment_name, sum(bytes)/1024/1024 "SIZE in MB" from dba_segments where segment_name='POLICY_CONFIGURATION' and owner ='MARTDATA' group by owner, segment_name;
    OWNER SEGMENT_NAME SIZE in MB
    MARTDATA POLICY_CONFIGURATION 18458
    SQL> select owner, segment_name, sum(bytes)/1024/1024 "SIZE in MB" from dba_segments where segment_name='MLOG$_POLICY_CONFIGURATION' and owner ='MARTDATA' group by owner, segment_name;
    OWNER SEGMENT_NAME SIZE in MB
    MARTDATA MLOG$_POLICY_CONFIGURATION 32298
    Thanks

    Oracle automatically purges rows in the materialized view log when they are no longer needed. Because Oracle must wait for all dependent materialized views to refresh before purging rows from a materialized view log, unwanted situations can occur that cause a materialized view log to grow indefinitely when multiple materialized views are based on the same master table or master materialized view.
    For example, such situations can occur when more than one materialized view is based on a master table or master materialized view and one of the following conditions is true:
    Materialized view is not configured for automatic refreshes and has not been manually refreshed for a long time. OR
    Materialized view has an infrequent refresh interval, such as every year, etc
    You can also refresh the materialized views associated with the log so that Oracle can purge rows from the materialized view log.
    If a materialized view log needs to be purged manually for some reason a procedure called DBMS_MVEW.PURGE_LOG can be used.
    Edited by: user130038 on Sep 30, 2011 6:49 AM

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

  • Performace issue on MATERIALIZED view

    Hi Gurus,
    Need help to understand perfoamance issue on MATERIALIZED view. I have created mat view on some big table of 76GB. Mat view is of 25 GB.
    I have refreshed mat view before running report. In OEM it ish showng going for full table scan and estimated time is of 2 hrs where full tablescan on base table on which mat view is created is of 20 Mins . I am using fast refresh on demand .
    We are using Oracle 10.2.0.4 on Sun Sprac 64bit 10 platform and version.
    Could you please let me know what could be the reason why mat views are performing poor ?
    Thanks & Regards

    You have MLOG created on your master table, right?
    OK, then check DBA_MVIEWS. Look for LAST_REFRESH_TYPE, If everything is OK, i should be FAST.
    If everything is OK by now, the problem can be the nature of master table. If there is great amount of changes in master table, set periodic job which will do refresh often (since 'often' is fuzzy word, it can be every 5, 10, 30 minutes...). Incremental refresh will perform beter if there is small amount of changes in MLOG table!
    You can check your MLOG table. If it is huge (size in MB) and there is only few records in it, try to realocate the space issuing "ALTER TABLE MLOG$_table_name;"
    Hope something will be helpfull...
    Best regards

  • Materialized view creation issue

    I am running into an issue and trying to ascertain issue.
    Scenario:
    I have 2 MV creation scripts. The MV is supposed to get populated by connection from schema to another schema USING DB Links.
    Basically, SAME HOST, SAME RAC DATABASE, just separate schemas.
    The MV creations are just hanging. I see NO alert log mentions. I ran  a SQL trace and yes, I see:
    call count       cpu elapsed       disk query    current        rows
    Parse 0      0.00 0.00 0          0 0           0
    Execute   1011 1.40 73.80 0 0 0           0
    Fetch 1010      1.08 317.57 0 0 0        1010
    total 2021      2.49 391.38 0 0 0        1010
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 109     (recursive depth: 2)
    Elapsed times include waiting on following events:
      Event waited on Times Max. Wait  Total Waited
      ---------------------------------------- Waited  ----------  ------------
      SQL*Net message to dblink 2022 0.00          0.00
      SQL*Net message from dblink 2021 0.46        242.58
    Understandable, but when I do a selective query, the results come back pretty much within 5 seconds.
    DB version is 11.2.0.3.   Is there a BUG that I should know about?
    Here is a snippet:
    CREATE MATERIALIZED VIEW "SCHEMA"."MV_NAME_MV" USING INDEX REFRESH COMPLETE ON DEMAND AS (SELECT distinct mapguide_persons(pl.location_code) "FULL_NAME_COSTCENTER",
    mapguide_jobemp(pl.location_code) "TRUNCNAME_JOB",
    mapguide_empnum(pl.location_code) "FULLNAME_EMPNUMBER_PHONE",
    mapguide_english(pl.location_code) "ENGLISH_NAME_COSTCENTER",
    pl.function_type_lookup_code "FUNCTION_TYPE_LOOKUP_CODE",
    pl.location_code "LOCATION_CODE",
    pl.org_id "ORG_ID"
    FROM [email protected] pl
    WHERE pl.function_type_lookup_code not in ('VALUE','CONSULT')
    and sysdate between pl.active_start_date and active_end_date);
    *Network netstat –in output **
    netstat -in
    Kernel Interface table
    Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
    eth0       1500   0 58751025      0 0      0 27335255 0      0      0 BMRU
    eth0:1     1500 0      - no statistics available - BMRU
    eth0:2     1500 0      - no statistics available - BMRU
    eth1       1500   0 5569305513      0 0      0 4365204661 0      0      0 BMRU
    eth2       1500   0 146061981      0 0      0 270589939 0      0      0 BMRU
    eth2:1     1500 0      - no statistics available - BMRU
    lo 16436   0 31731571 0      0      0 31731571      0 0      0 LRU
    The above just hangs and spins its wheels…
    Any ideas are appreciated…
    thanks

    JCGO wrote:
    The above just hangs and spins its wheels…
    And what happens when you issue just the underlying select:
    SELECT distinct mapguide_persons(pl.location_code) "FULL_NAME_COSTCENTER",
    mapguide_jobemp(pl.location_code) "TRUNCNAME_JOB",
    mapguide_empnum(pl.location_code) "FULLNAME_EMPNUMBER_PHONE",
    mapguide_english(pl.location_code) "ENGLISH_NAME_COSTCENTER",
    pl.function_type_lookup_code "FUNCTION_TYPE_LOOKUP_CODE",
    pl.location_code "LOCATION_CODE",
    pl.org_id "ORG_ID"
    FROM [email protected] pl
    WHERE pl.function_type_lookup_code not in ('VALUE','CONSULT')
    and sysdate between pl.active_start_date and active_end_date
    SY.

  • Issue with Materialized View ORA-08103: object no longer exists

    I have a materialized view which gets refreshed(COMPLETE Refresh) every 2 minutes. However there are few scheduled programs which queries this materialized view, some of the queries in the scheduled program take longer to run. When the materialized view refresh time overlaps with this query executing from the program i get this error: ORA-08103: object no longer exists.
    I know that COMPLETE refresh doing TRUNCATE + INSERT is causing the issue, could someone suggest a workaround for this. But i need to do a COMPLETE refresh.

    Why would a TRUNCATE cause an "object no longer exists" ?
    Which job encounters this error ? The MV Refresh job or the programs that are querying the MV ? How does it resolve ? Automatically -- meaning that the next refresh/query does not raise the error ?

  • Performance issue accessing Materialized Views

    Hi All
    I am extracting source data from Materialized View through DBLink which is having record count of 1500000 rows.
    But its taking lot of time(Approx. 30-45 min) during loading.
    Is there any other way to load the data in a faster way??
    regards
    Gourisankar

    Hi,
    I take it the simple 'Select from "materialized view' doesn't take this long. This could be down to the issue when issuing an 'INSERT' statement using a database link, even if you use the Optimizer hint 'DRIVING_SITE' does not help. The problem is that when issuing an INSERT statement using a DB LINK the filtering of records does not happen on the far side of the link. All the data is moved across the link to the target db, and then filtered etc.
    One way to get round this is to use a pipelined function to run your select to get your values, then call the pipeline function via ODI.
    Still use the DIRVING_SITE optimizer hint in the pipelined function when selecting your data.
    Cheers
    Bos

  • Issue with fast refresh on a materialized view

    Hi,
    Oracle DB version is 10.2.0.3
    We have a matierialized view created using this script. We have materialized view logs on these six tables.
    By default, it is set to ON COMMIT .
    When a batch job is run every morning (usually 100-200 records) we set it to ON DEMAND and then bring it back to ON COMMIT. It takes around 1-2 minutes.
    If the batch is unusually big, like say 100,000 it takes more than 5 hours to put it back on ON COMMIT. (We analyze the schema (GATHER STALE) before refreshing the MV.) Trace shows deletes taking a long time.
    When I see a big batch, I usually drop the view and recreate it with indexes (there is also a context index). Takes 30 mins to do the whole thing.
    I tried refreshing it COMPLETE when the num of rows is high but it still takes more than 2 hours..(I killed it)
    Is there any way to speed things up without dropping and recreating the MV ?
    thanks
    Mat view creation script:
    CREATE MATERIALIZED VIEW WCC_INTERNAL_SEARCH_M
    TABLESPACE ICV_TS_WCC_DATA
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH FAST ON COMMIT
    WITH ROWID
    AS
    SELECT orgname.ROWID orgname_rowid,
    cnt.ROWID cnt_rowid,
    locgrp.ROWID locgrp_rowid,
    cntry.ROWID cdcntry_rowid,
    addrgrp.ROWID addrgrp_rowid,
    addr.ROWID addr_rowid,
    cnt.cont_id cont_id,
    decode(cntry.name,'US',substr(addr.postal_code,1,5),addr.postal_code) postal_code,
    cntry.name country,
    UPPER(addr.addr_line_one) addr_line_one,
    UPPER(addr.addr_line_two) addr_line_two,
    UPPER(addr.addr_line_three) addr_line_three,
    UPPER(addr.CITY_NAME) city_name,
    UPPER(cnt.CONTACT_NAME) display_name,
    UPPER(orgname.ORG_NAME) org_name,
    addr.prov_state_tp_cd
    FROM orgname,
    contact cnt,
    locationgroup locgrp,
    cdcountrytp cntry,
    addressgroup addrgrp,
    address addr
    WHERE locgrp.cont_id = orgname.cont_id
    AND locgrp.cont_id = cnt.cont_id
    AND addrgrp.location_group_id = locgrp.location_group_id
    AND addr.country_tp_cd = cntry.country_tp_cd
    AND addr.address_id = addrgrp.address_id
    AND cnt.INACTIVATED_DT is null
    AND locgrp.END_DT is null
    AND orgname.END_DT is null
    AND cnt.person_org_code = 'O'
    AND cntry.lang_tp_cd = 100
    AND locgrp.member_ind = 'Y'
    AND locgrp.loc_group_tp_code = 'A'
    ORDER by org_name,city_name,postal_code,country;

    This is the script that creates the preferences and then the context index.
    exec ctx_ddl.create_preference('STEM_FUZZY_PREF', 'BASIC_WORDLIST');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_MATCH','AUTO');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_SCORE','60');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_NUMRESULTS','100');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','STEMMER','AUTO');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF', 'wildcard_maxterms',15000) ;
    exec ctx_ddl.create_preference('LEXTER_PREF', 'BASIC_LEXER');
    exec ctx_ddl.set_attribute('LEXTER_PREF','index_stems', 'ENGLISH');
    exec ctx_ddl.set_attribute('LEXTER_PREF','skipjoins',',''."+/-&');
    exec ctx_ddl.create_preference('ICV_WCC_INT_SEARCH_CTX_PREF', 'BASIC_STORAGE');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'I_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'K_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'N_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'I_INDEX_CLAUSE','tablespace ICV_TS_CTX_IDX compress 2');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'P_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'R_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    CREATE INDEX WCC_INT_SEARCH_CTX_I1 ON WCC_INTERNAL_SEARCH_M
    (ORG_NAME)
    INDEXTYPE IS CTXSYS.CTXCAT
    PARAMETERS('Wordlist STEM_FUZZY_PREF
    LEXER LEXTER_PREF
    STORAGE ICV_WCC_INT_SEARCH_CTX_PREF');
    DB is 10.2.0.3

  • Issue in Complete Refresh of a Materialized View

    Hello,
    We have an MV in the Datawarehouse that does a FAST REFRESH daily. Every Saturday, a COMPLETE REFRESH is done as part of the normal Database Activities. The Database is Oracle 9i. The MV contains a Join between a Dimension and Fact Table of a Datawarehouse and does a FAST REFRESH using the MV logs.
    However, last Sat, the COMPLETE REFRESH has failed. The DBA tried to run the script twice again but it failed on both occasions with an UNDO TABLESPACE error (ORA-30036). The DBA tried to extend the Tablespace; it did not help either.
    - Could this be linked to Tablespace allocations for the MV? Are there any specific steps that can be followed to resolve this?
    - Can the MV be dropped and re-created?
    Would appreciate a response on the same.
    Many Thanks,
    Ketan

    Hi Ketan,
    I guess this is probably because MV complete refresh performs "delete" from the MV and then insert. If the MV is large, it may fail on undo allocation.
    Please take a look at Re: materialized view refresh time!  Plz Help me! you can see the explanation, metalink note and the solution (how to perform truncate instead of delete).
    HTH
    Liron Amitzi
    Senior DBA consultant
    [www.dbsnaps.com]
    [www.orbiumsoftware.com]

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

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

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

Maybe you are looking for