Updating a Materialized View.

Hi,
I'm using Oracle 9.2.0.6.
We have a materialized view with this definition.
SET DEFINE OFF;
DROP SYNONYM APPSRO.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D;
DROP SYNONYM APPS.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D;
DROP MATERIALIZED VIEW FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D;
CREATE MATERIALIZED VIEW FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D
TABLESPACE APPS_TS_SUMMARY
NOCACHE
NOLOGGING
NOPARALLEL
BUILD DEFERRED
REFRESH FORCE ON DEMAND
WITH PRIMARY KEY
AS
SELECT
                         a.*
FROM
                         apps.ftbv_qt_esr_to_1st_esc_dtl_v a;
COMMENT ON TABLE FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D IS 'snapshot table for snapshot FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D';
GRANT ALTER, DELETE, INDEX, INSERT, REFERENCES, SELECT, UPDATE, ON COMMIT REFRESH, QUERY REWRITE, DEBUG, FLASHBACK ON  FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D TO APPS WITH GRANT OPTION;
GRANT SELECT ON  FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D TO APPSRO;
GRANT SELECT ON  FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D TO FTBV_REPORTING;
CREATE SYNONYM APPSRO.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D FOR FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D;
CREATE SYNONYM APPS.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D FOR FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D;We've updated the view that it's reading by adding a column 'CUSTOMER_NAME'. It looks like this.
CREATE OR REPLACE VIEW FTBV_QT_ESR_TO_1ST_ESC_DTL_V
(RESPONSE_TEAM, RESPONSE_COMMENTS, SALES_MGR, SALES_REP, DEAL_ID,
REQUEST_SUBMIT_DATE, RESPONSE_1ST_SUBMIT_DATE, ELAPSED_HRS, RESPONSE_1ST_SUBMIT_YYYY_MM, CUSTOMER_NAME)
AS
SELECT
          resp_1.team                                       AS response_team
        , resp_2.response_comments                          AS response_comments
        , user_r.sales_mgr_last                             AS sales_mgr
        , SUBSTR  ( deal.sales_rep_user_id, 2 )             AS sales_rep
        , TO_CHAR ( req.deal_id,'999999'      )             AS deal_id
        , req.submit_date                                   AS request_submit_date
        , resp_1.min_submit_date                            AS response_1st_submit_date
        , ROUND
            ( ftbv_om_ord_util.get_datetime_interval_char ( req.submit_date,resp_1.min_submit_date, 'dd', 'Y') * 24 ) +
            ( ftbv_om_ord_util.get_datetime_interval_char ( req.submit_date,resp_1.min_submit_date, 'hh', 'Y')      ) +
            ( ftbv_om_ord_util.get_datetime_interval_char ( req.submit_date,resp_1.min_submit_date, 'mi', 'Y') / 60 )
          , 2
          )                                                 AS elapsed_hrs
        , TO_CHAR ( resp_1.min_submit_date, 'YYYY-MM' )     AS response_1st_submit_yyyy_mm
        , cust.customer_name                                as customer_name
FROM      (
          SELECT    /*+ no_merge */
                    deal_id                                           AS deal_id
                  , team                                              AS team
                  , MIN ( submit_date )                               AS min_submit_date
          FROM
                    op_esc_prod
          GROUP BY
                    deal_id
                  , team
                                                               resp_1
          SELECT    deal_id                                           AS deal_id
                  , version_number                                    AS version_number
                  , team                                              AS team
                  , submit_date                                       AS submit_date
                  , CASE WHEN UPPER ( comments ) LIKE '%HI%TOUCH%'
                         THEN'High Touch'
                         WHEN UPPER ( comments ) LIKE 'HT%'
                         THEN'High Touch'
                         WHEN UPPER ( comments ) LIKE '%LO%TOUCH%'
                         THEN'Low Touch'
                         WHEN UPPER ( comments ) LIKE 'LT%'
                         THEN'Low Touch'
                         ELSE NULL
                    END                                               AS response_comments
          FROM
                    op_esc_prod
          )                                                    resp_2
          op_esr                                               req
          op_deal                                              deal
          op_customers                                         cust
          SELECT     user_id                                          AS user_id
                   , SUBSTR ( relation_id, 2 )                        AS sales_mgr_last
          FROM       op_user_relationship
          WHERE      relation                                          = 'SLSMGR'
                                                               user_r
WHERE
          resp_2.deal_id                                     = resp_1.deal_id         AND
          resp_2.team                                        = resp_1.team            AND
          resp_2.submit_date                                 = resp_1.min_submit_date
AND       req.deal_id                                        = resp_2.deal_id         AND
          req.version_number                                 = resp_2.version_number
AND       deal.deal_id                                       = req.deal_id
AND       user_r.user_id                                     = deal.sales_rep_user_id
AND       cust.op_customer_id                                = deal.op_customer_id
GROUP BY
          resp_1.team
        , resp_2.response_comments
        , user_r.sales_mgr_last
        , SUBSTR  ( deal.sales_rep_user_id, 2 )
        , TO_CHAR ( req.deal_id,'999999'      )
        , req.submit_date
        , resp_1.min_submit_date
        , TO_CHAR ( resp_1.min_submit_date, 'YYYY-MM' )
        , cust.customer_nameWhen we run the refresh we get the following error messages.
BEGIN dbms_snapshot.refresh('FTBV.FTBV_QT_ESR_TO_1ST_ESC_DTL_1D','C'); END;
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-00913: too many values
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 1I don't believe we're creating table for this MView I think we're just defining an MView and then populating it. For some reason it's not picking up the new column. Is there a reason why? What do I need to do?
Thanks

When you create an MV, Oracle automatically does create an underlying table with the same name. That is how it is a "materialized" view -- physical storage of the result set from the query defining the MV.
When you created this particular MV "FTBV_QT_ESR_TO_1ST_ESC_DTL_1D" ,
the "SELECT A.* FROM apps.ftbv_qt_esr_to_1st_esc_dtl_v a;"
was automatically translated to the specific columns in ftbv_qt_esr_to_1st_esc_dtl_v.
An table called FTBV_QT_ESR_TO_1ST_ESC_DTL_1D was actually created to store the results of the query. Therefore, it has the actual column names as well.
In fact, even if you created a View, the view gets created with the actual column names.
See :
SQL> create table a_1_t (col_1 number not null primary key, col_2 varchar2(5));
Table created.
SQL> insert into a_1_t values (1,'a');
1 row created.
SQL> commit;
Commit complete.
SQL> create view a_1_v as select * from a_1_t;
View created.
SQL> desc a_1_v
Name                                                                     Null?    Type
COL_1                                                                    NOT NULL NUMBER
COL_2                                                                             VARCHAR2(5)
SQL> create materialized view a_1_mv as select * from a_1_t;
Materialized view created.
SQL> desc a_1_mv
Name                                                                     Null?    Type
COL_1                                                                    NOT NULL NUMBER
COL_2                                                                             VARCHAR2(5)
SQL> select * from a_1_mv;
     COL_1 COL_2
         1 a
SQL> alter table a_1_t add (col_3 varchar2(10));
Table altered.
SQL> select * from a_1_v;
     COL_1 COL_2
         1 a
SQL> select * from a_1_mv;
     COL_1 COL_2
         1 a
SQL> exec dbms_mview.refresh(a_1_mv);
BEGIN dbms_mview.refresh(a_1_mv); END;
ERROR at line 1:
ORA-06550: line 1, column 26:
PLS-00357: Table,View Or Sequence reference 'A_1_MV' not allowed in this context
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
SQL> select col_1, col_2, col_3 from a_1_t;
     COL_1 COL_2 COL_3
         1 a
SQL> select col_1, col_2, col_3 from a_1_v;
select col_1, col_2, col_3 from a_1_v
ERROR at line 1:
ORA-00904: "COL_3": invalid identifier
SQL>I can still do a SELECT * from both the view A_1_V and the materialized view a_1_mv.
But I cannot see the 3rd column in either of them. (Note : This means that the view also wouldn't show the new column !!).
I cannot refresh the MV because there is physical storage of the columns.
Hemant K Chitale
http://hemantoracledba.blogspot.com

Similar Messages

  • Updating Materialized Views

    Hi,
    I am running a database on 10.2g version. I am new to Oracle Databases/SQL, so I need to know the possibility of updating the materialized views through a scheduler? Can I find any link where all the steps are described in order to update/refresh the materialized views (probably on a daily basis or on a weekly basis)? Any help would be appreciated.
    Thanks,
    Vipul

    Short answer: MVs can be refreshed automatically as specified at creation time (in this case this is handled internally by a DBMS_JOB job) or on demand: in this case you can try to use DBMS_SCHEDULER to create and schedule a job to call DBMS_MVIEW.REFRESH.
    Long answer: http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/refresh.htm#sthref826

  • ORA-12015: cannot create a fast refresh materialized view from a complex qu

    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - ProductionI'm trying to create a fast refresh materialized view that uses a column of xmltype. The problem is I cannot create an MV log that accounts for the xmltype column. I tried excluding it and got the above error. Is there another way I can incrementally update a materialized view where I don't have to do a COMPLETE refresh or use FAST refresh?
    CREATE TABLE "DAS_DESC"."AUTHORITY_TEST"
        "NAID"      NUMBER(20,0) NOT NULL ENABLE,
        "AUTH_TYPE" VARCHAR2(40 BYTE),
        "XML_DATA" "SYS"."XMLTYPE" ,
        "TERM_NAME" VARCHAR2(4000 BYTE)
    CREATE TABLE "DAS_DESC"."AUTH_ASSC_TEST"
        "NAID"    NUMBER(20,0),
        "P_NAID" NUMBER(20,0),
        "REL_TYPE"    VARCHAR2(25 BYTE),
        "XML_DATA" "SYS"."XMLTYPE"
    CREATE
    MATERIALIZED VIEW person_mv
    AS
    SELECT  p.naid
          , p.auth_type
          , INSERTCHILDXML
              p.xml_data                 -- Parent XML Column
            , '//*[contains(local-name(), ''person'')]' --XPATH to Person
            , 'nonPreferredHeadingArray'                -- Value for new child element
            (                                                       -- Sub query for injecting new variant person array
              SELECT XMLELEMENT
                "nonPreferredHeadingArray"
              , XMLAGG -- Aggregator for Variant Persons Array
                  XMLELEMENT
                    "variantPersonName"                    -- Wrapper for each entry in array
                  , extract(a.xml_data,'*/*')
              FROM auth_assc_table -- Link table
              WHERE a.p_naid = p.naid
          ) AS XML_DATA
    FROM authority p -- Parent table
    WHERE p.auth_type = 'Person';The views are created fine and they work perfectly for what we need. The problem is the refresh when we edit the base tables. Ideally, it should take a couple seconds. Right now, it takes a couple minutes. XMLTYPE is one problem and the Complex Query exception is the other. If there is a work-around for fast refresh, please let me know. Greatly appreciated.

    jjmdb wrote:
    I'm trying to create a fast refresh materialized view that uses a column of xmltype. The problem is I cannot create an MV log that accounts for the xmltype column. I tried excluding it and got the above error. Is there another way I can incrementally update a materialized view where I don't have to do a COMPLETE refresh or use FAST refresh? Besides XMLTYPE column, your MV definition has a subquery which prevents it from being fast refreshable.
    I could not find any specific reference in documentation about restriction on XMLTYPE (or CLOB) columns but it seems logical that oracle will not be able to keep track of changes to binary data. What does DBMS_MVIEW.EXPLAIN_MVIEW generate for your MV definition? That should tell you which all conditions (for FAST REFRESH) your MV violates. Since you can not create a MV LOG to include XMLTYPE column, it will not be possible to create a FAST REFRESHABLE MV that includes the XMLTYPE column.
    I am afraid there is not much you can do here unless you are prepared to change the way data is stored in your base tables. If you can store data in base tables using standard data types instead of binary/XML storage, you might be able to create a FAST REFRESHABLE MV.

  • Materialized view fast refresh raising error ORA-12031

    Hi All,
    I have a table named TblA on A database. I have created mview name mviewTblA on database B.
    When I tried to Complete refresh on mviewTblA it is getting refresh but with fast refresh it is raising an error i.e ORA-12031: cannot use primary key columns from materialized view log on "NIMS"."PIPER_ENABLED_EXCHANGES" ORA-06512: at "SYS.DBMS_SNAPSHOT", line 794 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 851 ORA-06512: at "SYS.DBMS_SNAPSHOT", line 832 ORA-06512: at line 2
    BEGIN
    DBMS_MVIEW.REFRESH('MVIEWTBLA','F');
    END;
    I checked with database "A", there is an materialized view log. Tell me how i can view/update that materialized view log i.e. want to see and confirm that materialized view log is created with primary key or not.
    Please suggest me on this.
    Message was edited by:
    user593684

    .. I use following code (from asktom.oracle.com) to check any limitations on mview
    variable x refcursor
    declare
    l_data EXPLAINMVARRAYTYPE;
    begin
    dbms_mview.explain_mview( '&MV_NAME', l_data );
    open :x for
    select capability_name, possible,
    msgno, msgtxt
    from table( cast( l_data as EXPLAINMVARRAYTYPE ) )
    order by seq;
    end;
    column msgtxt format a30 word_wrapped
    print x;

  • Materialized View Refresh; Process Flow

    I was wondering if anyone has used process flow to refresh materialized view;
    I am trying to use a process flow for this i.e. run something similiar to below
    EXECUTE dbms_refresh.refresh('"ODW_SRC"."MV_SERVICE_DAILY_AUDIT"');
    I am trying to avoid using DB scheduler because I want to make sure process flow doesn't clash with update of materialized view causing possible conflict of longer than expected job run time goes into refresh window.
    I am assuming I could use a transformation and build it out; but I was wondering if there is an easier way in just executing this one line ... any idea's
    Thank you in advance for your help

    Sorry, I think the OWB term is post mapping process, its actually an operator in an OWB mapping where you can add a procedure call for example. The procedure can do pretty much what it wants.
    Cheers
    David

  • UPDATING the query in materialized view

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

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

  • Updatable Materialized View with Union ALL

    (please don't ask about db structure)
    DB: 11gR2
    create table table_1  (
        id number primary key,
        val varchar2(100)
    create table table_2  (
        id number primary key,
        val varchar2(100)
    insert into table_1(id) values (0);
    insert into table_1(id) values (2);
    insert into table_1(id) values (3);
    insert into table_1(id) values (4);
    insert into table_1(id) values (5);
    insert into table_2(id) values (10);
    insert into table_2(id) values (12);
    insert into table_2(id) values (13);
    insert into table_2(id) values (14);
    insert into table_2(id) values (15);
    update table_1 set val='Table1 val:'||id;
    update table_2 set val='Table2 val:'||id;
    create view v_table_all as
    select * from table_1
    view V_TABLE_ALL created.
    select * from v_table_all;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      Table1 val:3                                                                                        
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    select column_name, updatable, insertable, deletable
    from user_updatable_columns
    where table_name = 'V_TABLE_ALL'
    COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE
    ID                             YES       YES        YES      
    VAL                            YES       YES        YES      
    update v_table_all set val='XXX changed' where id = 3;
    1 row updated.
    select * from table_1;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      XXX changed                                                                                         
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    rollback;
    select * from table_1;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      Table1 val:3                                                                                        
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    create or replace view v_table_all as
    select * from table_1
    union select * from table_2;
    view V_TABLE_ALL created.
    select * from v_table_all;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      Table1 val:3                                                                                        
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    10                     Table2 val:10                                                                                       
    12                     Table2 val:12                                                                                       
    13                     Table2 val:13                                                                                       
    14                     Table2 val:14                                                                                       
    15                     Table2 val:15  
    select column_name, updatable, insertable, deletable
    from user_updatable_columns
    where table_name = 'V_TABLE_ALL'
    COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE
    ID                             NO        NO         NO       
    VAL                            NO        NO         NO       
    trying update:
    update v_table_all set val='XXX changed' where id = 3;
    SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
    01732. 00000 -  "data manipulation operation not legal on this view"
    *Cause:   
    *Action:
    drop view v_table_all;
    view V_TABLE_ALL dropped.all is ok before this point.
    now we want create a new materialized view with some query
    create  materialized view v_table_all
    as
    select * from table_1
    union all select * from table_2 ;
    materialized view V_TABLE_ALL created.
    select column_name, updatable, insertable, deletable
    from user_updatable_columns
    where table_name = 'V_TABLE_ALL'
    COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE
    ID                             YES       YES        YES      
    VAL                            YES       YES        YES       it seems to be ok with update.
    but...
    update v_table_all set val='XXX changed' where id = 3;
    SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
    01732. 00000 -  "data manipulation operation not legal on this view"
    *Cause:   
    *Action:How can solve this issue??
    Any suggestion

    Looks like user_updatable_columns sort of thinks the MV is just a table - I don't know about that...
    An MV on a single table can be updated - I tried that and it works:
    create materialized view mv_table_1 for update
    as
    select * from table_1;I noticed [url http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/advmv.htm#sthref294]examples stating the UNION ALL needs a "marker" so Oracle can know from the data which source table a row in the MV originates from - like this:
    create materialized view v_table_all for update
    as
    select 'T1' tab_id, table_1.* from table_1
    union all
    select 'T2' tab_id, table_2.* from table_2 ;But that also fails (the "marker" requirement was specifically for FAST REFRESH, so it was just a long shot ;-) )
    What are you planning to do?
    <li>Create the MV.
    <li>Update records in the MV - which then is no longer consistent with the source data.
    <li>Schedule a complete refresh once in a while - thereby overwriting/losing the updates in the MV.
    If that is the case, I suggest using a true table rather than an MV.
    <li>Create table t_table_all as select ... .
    <li>Update records in the table - which then is no longer consistent with the source data.
    <li>Schedule a job to delete table and insert into table select ... once in a while - thereby overwriting/losing the updates in the table.
    In other words a kind of "do it yourself MV".
    I cannot see another way at the moment? But perhaps try in the data warehousing forum - the people there may have greater experience with MV's ;-)

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

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

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

  • Identifying updated column in materialized view logs

    Hi all,
    I created a materialized view log for a table with three columns(say colA,colB,colC). Is there any way to identify which column got updated among these three columns? through the entries in mat view logs?
    any inputs on this ll be of great help.
    Thanks in advance.
    gopi

    Can someone tell me about M_ROWS$$ column in Materialized view.
    I am in confucion.

  • Update sequence wrong in Materialized view when using refresh group

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

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

  • Materialized views  not updating

    I'm having trouble with getting a materialized view with fast refresh to update. I'm working between two schemas and have the global query rewrite privilege for both users. I've run the catrep.sql script to make sure it had been run and find that it has a lot of packages that don't compile, which I guess is expected as I'm not using Advanced Replication. I think the problem is that I can't get the dbms_snapshot package to compile so can't even update the view manually. Is there another script I need to run to make the materialized views work? Some other privilege or variable?
    I've granted permissions on tables, views, materialized views, triggers, and snapshots to both users.
    The log does get entries but never sends them to the views.
    I have a base table and a log on the table in schema 1.
    I have a materialized view in schema 2:
    create materialized view log on schema1.document
    tablespace app_mview
    with primary key
    ( list columns needed);
    create materialized view schema2.doc_mv
    pctfree 0
    tablespace app_mview
    storage (initial 128k next 128k pctincrease 0)
    refresh fast
    start with sysdate
    next sysdate + 1/1440
    as select * from schema1.document
    Does anyone know where my problem might be?
    thanks for any help

    I have temporary parameters, not in itit.ora but echoing the job_queue_processes is 10, job_queue_interval is 60.
    a sho err returns no errors.
    earlier I did not get anything new in dba_errors when trying to compile. Since I've rerun the catrep.sql I'm getting pls-00201 - identifier must be declared for a lot of dbms_snap, sys.dbms_alert, dbms_reputil2 etc. (package, package body, and trigger types) That is why I think there must be another script that should be run that I don't know about.
    I can't do a full refresh because the dbms_snapshot package will not compile. I believe it's possible that both full and fast will work once I get the dbms_snapshot package working.
    thanks for your help
    pat

  • Updating base table with Materialized View's data

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

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

  • Updatable Materialized View and Master Table on same database

    Hi all,
    My first question - Is it possible to have an Updatable Materialized View and the associated Master Table located on the same database?
    This is the requirement scenario:
    One unique database D exists.
    A is a batch table. Only inserts are allowed on Table A.
    M is an updatable materialized view on Table A (Master). Only updates are allowed on M (no insert or delete).
    Requirement is to push updates/changes from M to A periodically and then get the new inserted records from A into M via a refresh.
    Is this possible? What other approaches are applicable here?

    John,
    My question is related to the implementation and setup of the environment as explained in the above example. How can I achieve this considering that I have created an updatable m-view?
    If possible, how do I push changes made to an updatable m-view back to it's master table when/before I execute DBMS_MVIEW.REFRESH on the m-view? What is the procedure to do this if both table and mview exist on the same database? Do I need to create master groups, materialized view refresh groups, etc.?
    One more thing.. Is there a way to retain changes to the m-view during refresh? In this case, only newly inserted/updated records in the associated table would get inserted into m-view. Whereas changes made to m-view records would stay as-is.
    Hope my question is directed well. Thanks for your help.
    - Ankit

  • Scheduling updatable materialized view

    Hi everybody,
    As you may know I have a solution in which I have 5 sites .One master site with 4 updatable materialized view sites.
    I want to know that is it correct if I dont set up schedule push to run periodically and set it up to do continuous push ?
    I want in at least 2 minutes all sites become update and I have to mention that at first I tried multimaster but our client doesn't want that because they want if one special site becomes unavailable they others can not transfer data to eachother.
    I appreciate your help in advance.

    Your requirements are a bit unclear...
    1) In general, if you are looking to have sites updated within a minute or two of the original transaction being committed, you are better off looking at something like Streams rather than using materialized views.
    2) Architecturally, when you set up multi-master replication (which it sounds like you are attempting to do here), you need to choose between synchronous and asynchronous replication. Synchronous replication means that a transaction cannot commit until it has been pushed to all the other nodes, which is great for latency but horrible for performance, scalability, and availability. Very, very few people really want synchronous replication. That leaves asynchronous replication, which would require you to schedule jobs to replicate changes. Some folks who think they want asnychronous replication really want another technology entirely (i.e. DataGuard, RAC, etc).
    3) Are you sure about the requirement "they want if one special site becomes unavailable they others can not transfer data to each other"? That says that if one site fails, they want all transactions everywhere to fail. That pretty much defeats the purpose of setting up multi-master replication. If the system is only available as long as every node is available, and you're going to incur the overhead of synchronous replication on every change, you would be far better served consolidating everything into a single data center and potentially using RAC to create a multi-node cluster to spread the work among nodes. There would be very little benefit to offset the complexity of configuring and maintaining a multi-master replication environment if you didn't want the nodes to be able to continue in the event that one of them failed.
    Justin

  • Updatable materialized view

    Can someone help with this scenario:
    Say I have a master site 1 that has two tables T1A and T1B. I would like to have these tables viewable and updatable on another site 2. Site 1 is on a ship and site 2 is on a shore. Site2 will have access to Site 1 on port 1521.
    I have read some on "materialized view" but I'm still not clear how to push the updates made on Site 2 back to Site1.
    Can someone provide sample scripts to make replication happens between the two sites?
    Thank you.

    hi,
    try goin thru this online documentation by oracle for details =>
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10732/toc.htm
    and for step by step setup of an updatable MV replication =>
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10733/toc.htm

Maybe you are looking for

  • Same dimension multiple times in a Grid

    I'm working on a HFR report where I need to pull the Accounts and C1 in rows and Alt Hierarchy of C1 in columns. Any ideas? I tagged the Alt Hierachy C1 members with UD1 tagging in Metadata. But I'm unable to pull inside a HFR report. AltHierachy of

  • Office 2010

    office 2010 came installed on my computer.  somehow i lost it ( computer was worked on by hp support, i think in sept.)   i tryed to open some of my documents today dec 13 2013 & could not. i can't find the key to re-install.  how can i recover the k

  • I phone 3 problem using new software

    I am using iphone 3 just updated the latest software and it is hanged cannot come back also. please suggest how to get back my iphone to normal. Thanks..

  • Push stopped working

    I've just upgraded my iphone and itunes, but I am unable to use icloud as my computer keeps telling me the "apple Push has stopped working".  Has any one got any solutions?

  • Secure Access Control Server for Windows.

    Is this software licensed by server with an unlimited amount of devices that connect to it? Or do I license each device that uses it?