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.

Similar Messages

  • Materialized view creation taking long time

    Hi All,
    We are creating a dimensional OLAP model with the Materialized views. In that we are having 7 dimensions and 1 fact table. I have created all the dimensions with the materialized views with out any problem. But when im trying to create my Fact materialized view it is running for 14 hours and is still running. I'm waiting to see when it will complete. The select statement in the Fact MV returns only 19 records and that too in seconds. But when i use the same select statement for MV creation it is taking a long time. I dont know how long it gonna take. How can i reduce this long running time. Mean while my fact MV is having nearly 15 joins with other physical tables and dimensions.
    Thanks in advance,
    Karthick

    Hi all,
    Thanks for your reply..
    I think i dint clearly mention my problem..
    The select statement for the MV will return 19 records. But when im trying to create the MV it is taking quite a long time. it ran for >14 hours but still it dint create a MV. Why is it happening like this? Is it possible to increase the performance.
    Thanks,
    Karthick

  • Materialized View creation with REFRESH FAST

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

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

  • Materialized View - creation and schedule (To automate Refresh)

    Hi All,
    I have one table based on SQL Query (multiple tables) and loading data every day through procedure.
    When I execute the procedure is taking lot of time to load data. That’s why I am planning to create Materialized view to refresh the data in a table every day at some point of time (ex:-9.00 am).
    Exclude procedure and materialized view are there any ways to refresh the data?
    Can you and all please help me to create materialized view and schedule (Automate refresh).
    begin
    insert into CLAIMS_PRODUCT_TAB
    select
    substr(at.ATN_VOUCHER_NUMBER,1,6) as BRANCH,
    t.MONTH_NAME as MONTH,t.FISCAL_YEAR as YEAR,
    bb.ACC_ACCOUNT_TYPE as TYPE,
    aa.ACC_DEPARTMENT_CODE as DEPT,
    pr.PRODUCT_NAME as PRODUCT,
    case bb.ACC_ACCOUNT_TYPE when '1301' then 'Claims Paid' when '5383' then 'Claims OS' end as HEAD,
    case aa.ACC_DEPARTMENT_CODE when '31' then 'OD' when '32' then 'TP' when '39' then 'TP Pool' end as DEPT_NAME,
    count(distinct at.CLAIM_ID) as CLAIMS,
    --count( distinct at.POLICY_ID) as POLICIES,  
    sum(atd.ATD_CREDIT_AMOUNT - atd.ATD_DEBIT_AMOUNT) as totals
    from
    ACCOUNTING_TRN_DETAIL atd,time t,
    ACCOUNT bb,
    ACCOUNT aa,claim c, policy p,product pr,
    accounting_transaction at
    where bb.ACC_ACCOUNT_ID = aa.ACC_ACC_ACCOUNT_ID
    and at.CLAIM_ID = c.CLAIM_ID
    and c.POLICY_ID = p.POLICY_ID
    and p.PRODUCT_ID = pr.PRODUCT_ID
    and aa.ACC_ACCOUNT_ID = atd.ACC_ACCOUNT_ID
    and atd.ATN_ACCOUNTING_TRANSACTION_ID = at.ATN_ACCOUNTING_TRANSACTION_ID
    and trunc(at.ATN_TRANSACTION_DATE) = t.CAL_DATE
    and (bb.ACC_ACCOUNT_TYPE in ('1301','5383'))
    group by substr(at.ATN_VOUCHER_NUMBER,1,6)
    ,t.MONTH_NAME
    ,t.FISCAL_YEAR,bb.ACC_ACCOUNT_TYPE
    ,aa.ACC_DEPARTMENT_CODE
    ,pr.PRODUCT_NAME
    , case bb.ACC_ACCOUNT_TYPE when '1301' then 'Claims Paid' when '5383' then 'Claims OS' end
    ,case aa.ACC_DEPARTMENT_CODE when '31' then 'OD' when '32' then 'TP' when '39' then 'TP Pool' end );
    end;
    Thanks and Regards
    Venkat

    Is the MV and the source tables on the same database? If this is a remote MV, then check the source site if there are any issues (TEMP, UNDO space issues).

  • 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

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

  • 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

  • ORACLE 11G XE-Materialized view info/issue

    Hi,
    I have two Oracle XE databases with the version 11g, now i want to sync both of this dbs using materialized view feature.
    I have created base table in primary db and created materialized view in secondary db using db link.
    It got created and am able to view the records first time. but when i am selecting view next time its not reflecting changed records.
    Please suggest what needs to do to get it reflected in secondary db.
    mv query is as below
    CREATE MATERIALIZED VIEW mv_emp_pk
         REFRESH FAST START WITH SYSDATE
         NEXT SYSDATE + 1/86400
         WITH PRIMARY KEY
         AS SELECT * FROM emp@remote_db;
    Regards
    Kiran

    The name of this forum is "Streams" not "Materialized Views." Please post your question in the correct forum. Thank you.

  • View creation issue

    Hi ALL,
    I am a DBA and trying to create a view , but oracle giving me the following errors. one thing to note here that , when I try to remove ")" from line 24 , oracle allows me to create , but with the following compilation errors.
    ++
    SQL> show err view "RDS"."INTEGRATOR_RECIPE_V"
    Errors for VIEW "RDS"."INTEGRATOR_RECIPE_V":
    LINE/COL ERROR
    0/0      ORA-00918: column ambiguously defined
    0/0      ORA-01730: invalid number of column names specified
    +++++++
    SQL> show err
    No errors.
    SQL> CREATE OR REPLACE FORCE VIEW "RDS"."INTEGRATOR_RECIPE_V" ("FRL_ID", "FMP_ID", "FMP_ID_PATHFINDER", "PLT_ID", "SAP_PLANT_ID",
      2    "PLANT_NAME", "SAP_VENDOR_ID", "PROD_SITE_ID", "PLANT_MASS_CODE", "MASS_CODE", "DESCRIPTION", "EQUIPMENT_TEXT", "PROCEDURE_TEXT", "PLANT_REMARKS",
      3     "MANUFACTURING_TEXT", "CLEANSING_AGENT", "SANITIZING_AGENT", "SANITIZING_FREQUENCY", "VALID_FROM", "VALID_TO",
       "SAP_BOM_STATUS_ID", "UOM", "BATCH_SIZE_MIN", "BATCH_SIZE_MAX", "SAP_PROCESS_DESC", "SAP_STATUS_DESC") AS
      4    5    SELECT /*+ rule */ frl.frl_id,
      6        fmp.fmp_id,
      7         fmp.fmp_id_pathfinder,
      8         frl.plt_id,
      9         plt.sap_Plant_ID,
           plt.plant_name,
    10   11         plt2.sap_vendor_id,
    12         substr(plt.mfg_loc_id,1,3) prod_site_id,
    13         frl.plant_mass_code,
           frm.mass_code,
    14   15         fpd.description,
    16         fet.equipment_text,
    17         fpt.procedure_text,
    18         frl.plant_remarks,
    19         --fmp.manufacturing_text,  changed by MDK as per Rohit
    20         --DECODE(fmp.manufacturing_text, NULL,
    21         DECODE(rds.get_additional_ingredients(frm.frm_id),NULL,NULL,'Full Formula Extender(s): '|| rds.get_additional_ingredients(frm.frm_id)),
    22         fmp.manufacturing_text || Chr(13) || Chr(10)) ||
    23         --  DECODE(rds.get_additional_ingredients(frm.frm_id),NULL,NULL,'Full Formula Extender(s): '|| rds.get_additional_ingredients(frm.frm_id))
    24         manufacturing_text,
    25         rds.GET_MANUFACTURING_TEXT(fmp.fmp_id) manufacturing_text,
    26         '' cleansing_agent,
    27         '' sanitizing_agent,
    28         '' sanitizing_frequency,
    29         to_char(frl.valid_from, 'DD-MON-YYYY') valid_from, --force YYYY otherwise XML shows YY
    30         to_char(frl.valid_to, 'DD-MON-YYYY') valid_to,--force YYYY otherwise XML shows YY
    31         RLS.SAP_BOM_STATUS_id,
    32         RTRIM(rds.GET_RDS_UOM(replace(frm.mass_code, '-')))  uom,
    33         --fbs.batch_size_min,
    34         decode(RTRIM(GET_RDS_UOM(replace(frm.mass_code,'-'))), 'KG', fbs.batch_size_min * 1, 'GM', fbs.batch_size_min* 1000)  batch_size_min, --fbs.batch
    _size_max,
    35         decode(RTRIM(GET_RDS_UOM(replace(frm.mass_code, '-')))
    36  , 'KG', fbs.batch_size_max * 1, 'GM', fbs.batch_size_max* 1000) batch_size_max,
    37         rpad(trim(fpd.abbr_description)||' R:'||trim(fmp.revision_number),40)||chr(13)||chr(10)||'Full Process Description: '||trim(fpd.description)|| '
    Rev: '||trim(fmp.revision_number)   SAP_Process_Desc,
    38           rls.sap_status_desc
    39         --trim(fpd.abbr_description)||' R:'||trim(fmp.revision_number)   SAP_Process_Desc
    40  FROM   rds.formula_release        frl,
    41         rds.RELEASE_STATUS         RLS,
    42         rds.formula_process        fmp,
    43         rds.fmp_batch_size         fbs,
    44         rds.plant                  plt,
    45         rds.plant                  plt2,
    46         rds.PROCESS_DESCRIPTION    fpd,
    47         rds.fmp_procedure_text     fpt,
    48         rds.fmp_equipment_text     fet,
    49         rds.master_formula         frm,
    50         rds.project                prj,
    51         rds.product                prd
    52  WHERE  frl.fmp_id = fmp.fmp_id
    53  AND    fmp.fpd_id = fpd.fpd_id
    54  AND    fmp.frm_id = frm.frm_id
    55  AND    frm.prj_id = prj.prj_id
    56  AND    prj.prd_id = prd.prd_id
    57  and    FRL.rls_id = RLS.rls_id
    58  AND    frl.parent_plt_id = plt.plt_id
    59  AND    frl.plt_Id = plt2.plt_id
    60  and    fmp.fmp_id = fpt.fmp_id(+)
    and    fmp.fmp_id = fet.fmp_id(+)
    61   62  and    fmp.fmp_id = fbs.fmp_id(+)
    63  --AND    fmp.fmp_id_pathfinder = fpt.fmp_id(+)
    64  --AND    fmp.fmp_id_pathfinder = fet.fmp_id(+)
    65  --AND    fmp.fmp_id_pathfinder = fbs.fmp_id(+)
    66  /
           fmp.manufacturing_text || Chr(13) || Chr(10)) ||
    ERROR at line 22:
    ORA-00923: FROM keyword not found where expected

    It's difficult to see your code especially as some lines seem to have been commented out and it's not clear what is supposed to be a column alias or an actual column name.
    I've taken a good guess...
    CREATE OR REPLACE FORCE VIEW RDS.INTEGRATOR_RECIPE_V AS 
      SELECT /*+ rule */  -- WTF is this hint being used for?  STRONGLY advise against it.
             frl.frl_id
            ,fmp.fmp_id
            ,fmp.fmp_id_pathfinder
            ,frl.plt_id
            ,plt.sap_Plant_ID
            ,plt.plant_name
            ,plt2.sap_vendor_id
            ,substr(plt.mfg_loc_id,1,3) prod_site_id
            ,frl.plant_mass_code
            ,frm.mass_code
            ,fpd.description
            ,fet.equipment_text
            ,fpt.procedure_text 
            ,frl.plant_remarks 
            --,fmp.manufacturing_text,  changed by MDK as per Rohit 
            --,DECODE(fmp.manufacturing_text, NULL, 
            DECODE(rds.get_additional_ingredients(frm.frm_id),NULL,NULL,'Full Formula Extender(s): '||rds.get_additional_ingredients(frm.frm_id))  -- THIS LINE NEEDS AN ALIAS
            ,fmp.manufacturing_text || Chr(13) || Chr(10) as manufacturing_text
            --  ||DECODE(rds.get_additional_ingredients(frm.frm_id),NULL,NULL,'Full Formula Extender(s): '|| rds.get_additional_ingredients(frm.frm_id)) 
            ,rds.GET_MANUFACTURING_TEXT(fmp.fmp_id) manufacturing_text  -- THIS IS A DUPLICATE of the previous column name 
            ,'' cleansing_agent
            ,'' sanitizing_agent 
            ,'' sanitizing_frequency
            ,to_char(frl.valid_from, 'DD-MON-YYYY') valid_from --force YYYY otherwise XML shows YY 
            ,to_char(frl.valid_to, 'DD-MON-YYYY') valid_to     --force YYYY otherwise XML shows YY 
            ,RLS.SAP_BOM_STATUS_id
            ,RTRIM(rds.GET_RDS_UOM(replace(frm.mass_code, '-'))) uom 
            --fbs.batch_size_min, 
            ,decode(RTRIM(GET_RDS_UOM(replace(frm.mass_code,'-'))), 'KG', fbs.batch_size_min * 1, 'GM', fbs.batch_size_min* 1000)  batch_size_min --fbs.batch
            ,_size_max
            ,decode(RTRIM(GET_RDS_UOM(replace(frm.mass_code, '-'))), 'KG', fbs.batch_size_max * 1, 'GM', fbs.batch_size_max* 1000) batch_size_max
            ,rpad(trim(fpd.abbr_description)||' R:'||trim(fmp.revision_number),40)||chr(13)||chr(10)||'Full Process Description: '||trim(fpd.description)|| ' Rev: '||trim(fmp.revision_number) SAP_Process_Desc
            ,rls.sap_status_desc 
            --trim(fpd.abbr_description)||' R:'||trim(fmp.revision_number)   SAP_Process_Desc 
    FROM   rds.formula_release        frl, 
            rds.RELEASE_STATUS         RLS, 
            rds.formula_process        fmp, 
            rds.fmp_batch_size         fbs, 
            rds.plant                  plt, 
            rds.plant                  plt2, 
            rds.PROCESS_DESCRIPTION    fpd, 
            rds.fmp_procedure_text     fpt, 
            rds.fmp_equipment_text     fet, 
            rds.master_formula         frm, 
            rds.project                prj, 
            rds.product                prd 
    WHERE  frl.fmp_id = fmp.fmp_id 
    AND    fmp.fpd_id = fpd.fpd_id 
    AND    fmp.frm_id = frm.frm_id 
    AND    frm.prj_id = prj.prj_id 
    AND    prj.prd_id = prd.prd_id 
    and    FRL.rls_id = RLS.rls_id 
    AND    frl.parent_plt_id = plt.plt_id 
    AND    frl.plt_Id = plt2.plt_id 
    and    fmp.fmp_id = fpt.fmp_id(+) 
    and    fmp.fmp_id = fet.fmp_id(+) 
    and    fmp.fmp_id = fbs.fmp_id(+) 
    --AND    fmp.fmp_id_pathfinder = fpt.fmp_id(+) 
    --AND    fmp.fmp_id_pathfinder = fet.fmp_id(+) 
    --AND    fmp.fmp_id_pathfinder = fbs.fmp_id(+) 
    The duplicate column alias will cause the ambiguous column name problem.

  • Materialized view creation.

    hi experts.
    I have a requirement wherein I need to create a mview based on a single table.Mview is going to be a complex mview(uses correlated sub-queries in SELECT) and the source table resides in some other database. I need this mview refreshed once for a day.
    I created mview as BUILD IMMEDIATE REFRESH COMPLETE START WITH sysdate NEXT sysdate+1. Is this fine ?
    Please suggest if there is much efficient way of creating mview in this case?
    Thank you.

    How large is the source table? Have you considered the time it will take to complete the refresh?

  • Unexpected synonym creation via a materialized view DDL statement

    While I was doing some testing for a future materialized view creation I did this...
    create materialized view yes as select empno, ename from emp;Oracle created a table called "YES" and a materialized view called "YES".
    Then I did this...
    create materialized view wow as select empno, ename from emp;Oracle created a table called "WOW" and materialized view called "WOW", and a synonym called "WOW1"...
    Eh? Whats up with he synonym called "WOW1"?
    SQL*Plus: Release 9.0.1.4.0 -
    Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit

    I'm not able to reproduce this. My version is 9.2.0.7.0
    my_schema@mydb> create materialized view yes as select employee_id, salary from employees;
    Materialized view created.
    Elapsed: 00:00:01.00
    my_schema@mydb> select object_type, owner, object_name from dba_objects where object_name = 'YES';
    OBJECT_TYPE        OWNER                          OBJECT_NAME
    MATERIALIZED VIEW  my_schema                        YES
    TABLE              my_schema                        YES
    Elapsed: 00:00:00.03
    my_schema@mydb> create materialized view wow as select employee_id, salary from employees;
    Materialized view created.
    Elapsed: 00:00:00.04
    my_schema@mydb> select object_type, owner, object_name from dba_objects where object_name like 'WOW%';
    OBJECT_TYPE        OWNER                          OBJECT_NAME
    MATERIALIZED VIEW  my_schema                        WOW
    TABLE              my_schema                        WOW

  • 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 (creating and complete refresh)

    Good day.
    I have a huge query that is used to create a materialized view. The query consist of 9 joins, a lot of aggregations, some subqueries, so we can say it is rather huge. The query itself executes for about 30 seconds and returns about 200 rows. The materialized view creates and refreshes for more than 30 minutes. Can someone please explain me the mechanism of materialized view creation which causes such bad performance.
    We use Oracle Database 9.2.0.4.
    Thank you in advance.

    I've fount the solution. May be it will be useful for someone not regarding that 9.2 database is less used today than 10.2.
    I studied carefully the plan of the query and the plan of insert statement that is used when creating materialized view and found the cause of trouble. Insert statements generates VIEW PUSHED PREDICATE and BITMAP CONVERSION FROM ROWIDS when parsing. Bitmap conversion can be removed by setting environment parameter btree_bitmap_plans to false (a well-known issue), but I decided not ot change the production environment. The pushed predicate can be removed by using hint NO_PUSH_PRED to each subquery used in a materialized view. This step reduced the time of materialized view creation and execution to about a minute.
    Thank everyone who tried to help.

  • Refresh of a materialized view

    Hi All!
    I have a materialized view defined like:
    CREATE MATERIALIZED VIEW v_ship_info_new
    PCTFREE 5 PCTUSED 60
    TABLESPACE DATA_BIG
    STORAGE
    INITIAL 32768K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    USING INDEX STORAGE (INITIAL 2M NEXT 500K)
    REFRESH START WITH ROUND(SYSDATE + 1) + 08/24
    NEXT ROUND(SYSDATE + 2) + 08/24
    AS
    SELECT .....
    The view was created on Sep.-13-2005. I expected that the view will be refreshed today at 08:00 AM, but the last_ddl_time in user_objects is Sep.-18-2005 and the data in the view is also from Sep.-18-2005. There is no time filter in SELECT statement. The view should shows a result of left outer join of two tables.
    Any idea?
    Thanks,
    Andrej

    Andrej,
    You should consider the NEXT interval relative to the last materialized view refresh. Reading your materialized view definition it results that:
    - the materialized view was refreshed for the first time on 14-sep at 8:00 am (START WITH ROUND(SYSDATE + 1) + 08/24)
    - the materialized view is then refreshed on 16-sep at 8:00 am, 18-sep at 8:00 am (ROUND(SYSDATE + 2) + 08/24)
    Considering you have specified the START WITH clause in your command, the NEXT date should be considered starting from the timestamp of the last refresh and not from the moment of the materialized view creation.
    Regards,
    Adi

  • Error While Creating Fast Refresh Materialized view.

    Table Scripts:
    CREATE TABLE CONTRACT_MASTER
      CONTRACT_SEQ                    NUMBER(10)    NOT NULL,
      PDN                             CHAR(5)       NOT NULL,
      APPID                           NUMBER(10)    NOT NULL,
      CONTRACT_LOB_DESC               VARCHAR2(20)  NOT NULL,
      CUSTOMER_NAME                   VARCHAR2(57)  NOT NULL,
      CONTRACT_DT                     DATE          NOT NULL,
      CONTRACT_RECD_DT                DATE          NOT NULL,
      HELD_OFFERING_DT                DATE          NOT NULL,
      DRAFT_AMT                       NUMBER(15,2)  NOT NULL,
      STATUS_DESC                                   VARCHAR2(20)  NOT NULL,
      GIF_UPLOAD_TM                                            TIMESTAMP     NOT NULL
    CREATE table CONTRACT_COMMENTS
      CONTRACT_COMMENTS_SEQ           NUMBER(10)     NOT NULL,
      APPID                           NUMBER(10)     NOT NULL,
      COMMENTS                        VARCHAR2(1000) NOT NULL,
      GIF_UPLOAD_TM                                            TIMESTAMP      NOT NULL
    Constraints on tables
    ALTER TABLE CONTRACT_MASTER ADD
      CONSTRAINT XPKCONTRACT_MASTER PRIMARY KEY (CONTRACT_SEQ) USING INDEX ;
    ALTER TABLE CONTRACT_COMMENTS ADD
      CONSTRAINT XPKCONTRACT_COMMENTS PRIMARY KEY (CONTRACT_COMMENTS_SEQ) USING INDEX ;
    alter table CONTRACT_MASTER add CONSTRAINT XUIAPPCONTRACT_MASTER UNIQUE (APPID) USING INDEX;
    CREATE INDEX XUIAPPCONTRACT_COMMENTS ON
    CONTRACT_COMMENTS(APPID) ;
    Materialized View Creation:
    CREATE MATERIALIZED VIEW LOG ON CONTRACT_MASTER WITH PRIMARY KEY,ROWID;
    CREATE MATERIALIZED VIEW LOG ON CONTRACT_COMMENTS WITH PRIMARY KEY, ROWID;
    CREATE MATERIALIZED VIEW MV_CONTRACT_COMMENTS_HELDOFFERING
    REFRESH FAST
    ENABLE QUERY REWRITE AS
    SELECT APPID,COMMENTS FROM CONTRACT_COMMENTS  WHERE APPID IN (
    SELECT APPID FROM CONTRACT_MASTER WHERE STATUS_DESC = 'Held Offering' )
    Errors generated:
    ERROR at line 4:
    ORA-12015: cannot create a fast refresh materialized view from a complex query
    _*Afer That I have changed the query but still it was not created like:*_
    CREATE  MATERIALIZED VIEW MV_CONT_COMMNTS_HELDOFFERNG
    REFRESH FAST
    ENABLE QUERY REWRITE AS
    SELECT CONTRACT_COMMENTS_SEQ,c.APPID,COMMENTS
    FROM CONTRACT_COMMENTS c,CONTRACT_MASTER  m 
    WHERE m.APPID = c.APPID and m.STATUS_DESC = 'Held Offering'
    *even though error displayed:
    SQL> CREATE  MATERIALIZED VIEW MV_CONT_COMMNTS_HELDOFFERNG*
       2  REFRESH FAST
       3  ENABLE QUERY REWRITE AS
       4  SELECT CONTRACT_COMMENTS_SEQ,c.APPID,COMMENTS
       5  FROM CONTRACT_COMMENTS c,CONTRACT_MASTER  m
       6  WHERE m.APPID = c.APPID and m.STATUS_DESC = 'Held Offering';
    FROM CONTRACT_COMMENTS c,CONTRACT_MASTER  m
    ERROR at line 5:
    ORA-12052: cannot fast refresh materialized view GSSIO.MV_CONT_COMMNTS_HELDOFFERNG
    *Again I have done "Analyzing Materialized Views for Fast Refresh" as follows:*
    1: exec dbms_mview.explain_mview('MV_CONT_COMMNTS_HELDOFFERNG');
    2: SELECT capability_name,  possible, SUBSTR(msgtxt,1,60) AS msgtxt
               FROM mv_capabilities_table
               WHERE capability_name like '%FAST%';
    Output is :
    CAPABILITY_NAME                               P              MSGTXT                                                            
    REFRESH_FAST                                   N                                                                   
    REFRESH_FAST_AFTER_INSERT            N  the SELECT list does not have the rowids of all the detail t      
    REFRESH_FAST_AFTER_ONETAB_DML   N  see the reason why REFRESH_FAST_AFTER_INSERT is disabled          
    REFRESH_FAST_AFTER_ANY_DML         N  see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled      
    REFRESH_FAST_PCT                            N  PCT is not possible on any of the detail tables in the mater      
    Please suggest what to do to implement fast refresh materialized view for same.Edited by: dba on Sep 20, 2010 12:00 AM

    If the two MVs have to be consistent with each other as of a specific time, put them into a Refresh Group and refresh them with DBMS_MVIEW.REFRESH
    If an MV is dependent on another, use DBMS_MVIEW.REFRESH_DEPENDENT
    See the "Oracle® Database PL/SQL Packages and Types Reference" documentation pages for DBMS_MVIEW.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com --- this is NOT a documentation site.
    Edited by: Hemant K Chitale on Sep 20, 2010 5:19 PM

Maybe you are looking for