Altering a table in a materialized view environment

Hello everybody!.
My question is as simple as this:
When I have a single master - multiple materialized views environment , and I want to alter the master table (usually adding a column) , how do I propagate the change to the materialized view sites ?
In Oracle's documentation manuals it is written the process ONLY for the master sites.If I manually just alter the materialized views to the mat.views sites , the new columns DON'T take data from the master table!
It would be very nice if someone could help me.
Thanks everybody on advance!.
Thanasis Avdis

Hi,
you must dorp and recreate materialized view.

Similar Messages

  • Table Operator Vs Materialized View Operator

    Hi All,
    Could you please give the differences between Table Operator and Materialized view Operator in Oracle Warehouse Builder 11g.
    Regards,
    Subbu

    Below an extract of my notes of the Materialized view. The complete notes are here :
    http://gerardnico.com/wiki/dw/aggregate_table
    =====Notes=====
    Materialized views are the equivalent of a summary table. (Materialized views can be also use as replica).
    In a olap approach, each of the elements of a dimension could be summarized using a hierarchy.
    The end user queries the tables and views in the database. The query rewrite mechanism in a database automatically rewrites the SQL query to use this summary tables.
    This mechanism reduces response time for returning results from the query. Materialized views within the data warehouse are transparent to the end user or to the database application.
    This is relatively straightforward and is answered in a single word - performance. By calculating the answers to the really hard questions up front (and once only), we will greatly reduce the load on the machine, We will experience:
    * Less physical reads - There is less data to scan through.
    * Less writes - We will not be sorting/aggregating as frequently.
    * Decreased CPU consumption - We will not be calculating aggregates and functions on the data, as we will have already done that.
    * Markedly faster response times - Our queries will return incredibly quickly when a summary is used, as opposed to the details. This will be a function of the amount of work we can avoid by using the materialized view, but many orders of magnitude is not out of the question.
    Materialized views will increase your need for one resource - more permanently allocated disk. We need extra storage space to accommodate the materialized views, of course, but for the price of a little extra disk space, we can reap a lot of benefit.
    Also notice that we may have created a materialized view, but when we ANALYZE, we are analyzing a table. A materialized view creates a real table, and this table may be indexed, analyzed, and so on.
    Success
    Nico

  • Is it possible to refresh the table from a Materialized view

    Hi,
    Is it possible to update the underlying table on which a Materialized view is created when some changes in a Materialized view is done.Is this reverse compatibility possible in Materialized View?
    Thanks in Advance,
    V.Dennis

    If you created the materialized view as UPDATEABLE then changes to it should automatically be relected in the underlying table. If this is not occurring I suggest you check the replication jobs. You probably have a stack of errors in DEFERROR.
    Cheers, APC

  • Problem encountered when join two remote tables in a materialized view

    I'm using oracle 9.2.0.6
    1> I have two tables:
    CREATE TABLE TEST
    A VARCHAR2(100 BYTE),
    C DATE
    CREATE TABLE TEST1
    A VARCHAR2(100 BYTE),
    B TIMESTAMP
    2>. I defined a prebuild table:
    CREATE TABLE MV_TEST1
    ID1 ROWID,
    A VARCHAR2(100 BYTE),
    ID2 ROWID,
    B TIMESTAMP(6),
    C DATE
    3> I created mview logs:
    CREATE MATERIALIZED VIEW LOG ON PSI_TEST.TEST
    WITH ROWID
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW LOG ON PSI_TEST.TEST1
    WITH ROWID
    INCLUDING NEW VALUES;
    4> when I create mview:
    CREATE MATERIALIZED VIEW PSI_TEST.MV_TEST1
    ON PREBUILT TABLE WITH REDUCED PRECISION
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    select
    test.rowid id1,
    test.a,
    test1.rowid id2,
    test1.b,
    cast(null as date) c
    from test , test1
    where test.a = test1.a(+);
    It is created successfully.
    5> problem:
    when I use remote tables to do the same thing, say test and test1 are in another instance and are connected by a dbLink, I couldn't create the mview successfully:
    CREATE MATERIALIZED VIEW PSI_TEST.MV_TEST1
    ON PREBUILT TABLE WITH REDUCED PRECISION
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    select
    a.rowid id1,
    a.a,
    b.rowid id2,
    b.b,
    cast(null as date) c
    from test@dbl a, test1@dbl b
    where a.a = b.a(+);
    when run above statement, I got:
    ORA-12015: cannot create a fast refresh materialized view from a complex query
    Any ideas? Or joining two table through a dblink for a mview is not allowed at all?
    Thanks in advance.

    No one has a clue?
    Message was edited by:
    lzhwxy

  • Error insert data over db link in table covered by materialized view

    Hello together,
    following problem:
    I got a table called LOCATION_INFO which is defined:
    create table LOCATION_INFO
    LOCATION_ID VARCHAR2(40) not null,
    PLANT VARCHAR2(4) not null,
    PRODUCT VARCHAR2(3),
    AREA VARCHAR2(1),
    LINE NUMBER(10),
    STATION NUMBER(10),
    STATINDEX NUMBER(10),
    FU NUMBER(10),
    WP NUMBER(10),
    TP NUMBER(10),
    LOCATION_LEVEL NUMBER(1) not null,
    LOCATION_PARENT_ID VARCHAR2(40),
    TIME_STAMP TIMESTAMP(6) WITH TIME ZONE not null
    I try to load data over PL/SQL procedure from another database using database link:
    INSERT INTO LOCATION_INFO
    (LOCATION_ID,
    PLANT,
    PRODUCT,
    AREA,
    LINE,
    STATION,
    STATINDEX,
    FU,
    WP,
    TP,
    LOCATION_LEVEL,
    LOCATION_PARENT_ID,
    TIME_STAMP)
    SELECT LOCATION_ID,
    PLANT,
    PRODUCT,
    AREA,
    LINE,
    STATION,
    STATINDEX,
    FU,
    WP,
    TP,
    LOCATION_LEVEL,
    LOCATION_PARENT_ID,
    GetUTCDateTime(TIME_STAMP) AS time_Stamp
    FROM LOCATION_INFO@SOURCE_MMPDDB
    WHERE ROWNUM < 100;
    This works fine (If i do select count(*) from location_info the data is present) but if set a commit
    ORA-00603 appears and the session is terminated.
    The point is i got a materialized view MVIEW_LOCATIONS in another schema in the database reading the data from my table location_info and a corresponding MVIEWLOG.
    create table MLOG$_LOCATION_INFO
    LOCATION_ID VARCHAR2(40),
    SNAPTIME$$ DATE,
    DMLTYPE$$ VARCHAR2(1),
    OLD_NEW$$ VARCHAR2(1),
    CHANGE_VECTOR$$ RAW(255)
    CREATE MATERIALIZED VIEW MVIEW_LOCATIONS
    REFRESH FAST ON COMMIT
    ENABLE QUERY REWRITE
    AS
    SELECT "LOCATION_INFO"."LOCATION_ID" "LOCATION_ID","LOCATION_INFO"."PLANT" "PLANT","LOCATION_INFO"."PRODUCT" "PRODUCT","LOCATION_INFO"."AREA" "AREA","LOCATION_INFO"."LINE" "LINE","LOCATION_INFO"."STATION" "STATION","LOCATION_INFO"."STATINDEX" "STATINDEX","LOCATION_INFO"."FU" "FU","LOCATION_INFO"."WP" "WP","LOCATION_INFO"."TP" "TP","LOCATION_INFO"."LOCATION_LEVEL" "LOCATION_LEVEL","LOCATION_INFO"."LOCATION_PARENT_ID" "LOCATION_PARENT_ID","LOCATION_INFO"."TIME_STAMP" "TIME_STAMP" FROM "CP4MMPDNEW"."LOCATION_INFO" "LOCATION_INFO";
    What do I need to do to make the insert working properly without deleting my mviews?
    Can anyone help me?
    Thanks, Matthias

    Helllo,
    Can you change this on your Materialized View DDL:
    REFRESH FAST ON COMMITTo:
    REFRESH FAST ON DEMANDThen, if your INSERT and COMMIT works OK then, can you try:
    exec DBMS_MVIEW.REFRESH('MVIEW_LOCATIONS')

  • Inserting into a base table of a materialized view takes lot of time.......

    Dear All,
    I have created a materialized view which refreshes on commit.materialized view is enabled query rewrite.I have created a materialized view log on the base table also While inserting into the base table it takes lot of time................Can u please tell me why?

    Dear Rahul,
    Here is my materialized view..........
    create materialized view mv_test on prebuilt table refresh force on commit
    enable query rewrite as
    SELECT P.PID,
    SUM(HH_REGD) AS HH_REGD,
    SUM(INPRO_WORKS) AS INPRO_WORKS,
    SUM(COMP_WORKS) AS COMP_WORKS,
    SUM(SKILL_WAGE) AS SKILL_WAGE,
    SUM(UN_SKILL_WAGE) AS UN_SKILL_WAGE,
    SUM(WAGE_ADVANCE) AS WAGE_ADVANCE,
    SUM(MAT_AMT) AS MAT_AMT,
    SUM(DAYS) AS DAYS,
    P.INYYYYMM,P.FIN_YEAR
    FROM PROG_MONTHLY P
    WHERE SUBSTR(PID,5,2)<>'PP'
    GROUP BY PID,P.INYYYYMM,P.FIN_YEAR;
    Please help me if query enable rewrite does any performance degradation......
    Thanks & Regards
    Kris

  • The master table of a materialized view

    Hi Everybody,
    I have in my database a snapshot created on multiple tables, like this:
    create materialized view <some_name>
    as select <some_fields>
    from a,b, c
    where <some_join_conditions>
    Questions:
    1. What "algorithm" uses Oracle to determine the master table of the snapshot? The master table visible in USER_SNAPSHOTS?
    2. How can I change the master table chosed by Oracle with the table I want? I tried using some tuning hints (for example "leading table") but it is not working.
    The table I want to force as master table is a remote one accessed by dblink. Does this change anything?
    Thank you very much.
    Daniela

    We had issue with similar probelm and found that driving table is becoming master table, which was last table on your from clause (c).
    However the Query Optimizer is COST based, and we are not sure this holds true forever.
    We are looking at these answers too.

  • Alter the main tables of materialized views

    Hi
    I want to add a new column to the main table of a materialized view.Can anyone let me know,what are the steps I need to take care on materialized views,In addition to recompiling dependent objects?

    PER_SPECIAL_INFO_TYPES: This table holds the definitions of SITs that are available to each Business Group. Each special information type is a user defined structure for the personal analysis key flexfield. The name of the special information type is the same as the name of the corresponding key flexfield structure.
    PER_SPECIAL_INFO_TYPES_V : This table has the Employee's SIT info. A supplementary view used to simplify forms coding
    PER_SPECIAL_INFO_TYPES_V2 : A supplementary view used to simplify forms coding.

  • MATERIALIZED view on two tables with Fast Refresh

    i Wanted to create MV on two tables with Fast refresh on commit.
    I followed below steps
    create materialized view log on t1 WITH PRIMARY KEY, rowid;
    create materialized view log on t2 WITH PRIMARY KEY, rowid;
    CREATE MATERIALIZED VIEW ETL_ENTITY_DIVISION_ASSO_MV
    REFRESH fast ON commit
    ENABLE QUERY REWRITE
    AS
    select A.ROWID B.ROWID,a.c1, DECODE(a.c1,'aaa','xxx','aaa') c2
    from t1 A
    join t2 b
    on AB.c1= CD.c2;
    i am getting below error.
    Error report:
    SQL Error: ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
    *Cause:    The materialized view did not satisfy conditions for refresh at
    commit time.
    *Action:   Specify only valid options.
    Basically i want to take record in MV by joinig two tables and if both of the base tables will updated then record should reflect in materialised view.
    Please do the needfull.

    does the table support PCT? the other restrictions on joins look to be ok in your statement.
    maybe try creating first with on demand instead of commit to see does it create.
    http://docs.oracle.com/cd/B19306_01/server.102/b14223/basicmv.htm
    >
    Materialized Views Containing Only Joins
    Some materialized views contain only joins and no aggregates, such as in Example 8-4, where a materialized view is created that joins the sales table to the times and customers tables. The advantage of creating this type of materialized view is that expensive joins will be precalculated.
    Fast refresh for a materialized view containing only joins is possible after any type of DML to the base tables (direct-path or conventional INSERT, UPDATE, or DELETE).
    A materialized view containing only joins can be defined to be refreshed ON COMMIT or ON DEMAND. If it is ON COMMIT, the refresh is performed at commit time of the transaction that does DML on the materialized view's detail table.
    If you specify REFRESH FAST, Oracle performs further verification of the query definition to ensure that fast refresh can be performed if any of the detail tables change. These additional checks are:
    A materialized view log must be present for each detail table unless the table supports PCT. Also, when a materialized view log is required, the ROWID column must be present in each materialized view log.
    The rowids of all the detail tables must appear in the SELECT list of the materialized view query definition.
    If some of these restrictions are not met, you can create the materialized view as REFRESH FORCE to take advantage of fast refresh when it is possible. If one of the tables did not meet all of the criteria, but the other tables did, the materialized view would still be fast refreshable with respect to the other tables for which all the criteria are met.

  • Query on Materialized View created on Prebuilt Table

    Hi,
    I am trying to explain the scenario below on Materialized View which I want to setup for our database.
    I have created a materialized view on prebuilt table on target side on primary key. Now for purging history data from target side which are more than 5 years old I have executed the following steps:
    1. Dropped the materialized view which was created previously on prebuilt table in target side.
    2. Deleted the data from that target table which are more than 5 years old.
    3. Now created the materialized view again on the prebuilt table.
    Now, the problem which I am facing is that - if any changes happens in the source side during the above 3 steps on the target side those changed records were not captured even after successfully building materialized view again in the target side (i.e. after completing step-3 of above the intermediate changed records were not captured).
    Can you please let me know exactly what I am doing wrong here and how can I achieve my intended result.
    Regards,
    Koushik

    See matelink for doc id *252246.1*. The document id says: A materialized view was defined on a Table A. This table had a referential constraint defined against another table, Table B. This constraint was defined as 'ON DELETE CASCADE'. An 'ON DELETE CASCADE' constraint is not allowed on views but as the constraint was created on the table underlying the materialized view, Table A, it could be created although it would behave as a constraint on the view. The constraint existed for performance reasons, which is permitted, and was disabled when created but a general script had been run to enable all constraints. When a delete was performed on Table B the error above was reported although there was no view created on Table B.

  • Materialized View UNION different tables 10g.

    I am trying to create a materialized view from 2 different tables. According the documentation for 10G it should be available.
    Here is my script.
    DROP MATERIALIZED VIEW PERSON_MV_T16;
    CREATE MATERIALIZED VIEW PERSON_MV_T16 refresh complete on demand
    AS
    SELECT
    CAST(P.MARKER AS VARCHAR2(4)) AS MARKER,
    P.ROWID P_ROW_ID,
    CAST(P.ACTIVE_IND_DT AS DATE) AS ACTIVE_IND_DT
    FROM PERSON_ORGS_APEX_MV P
    UNION
    SELECT
    CAST(P.MARKER AS VARCHAR2(4)) AS MARKER,
    P.ROWID P_ROW_ID,
    CAST(P.ACTIVE_IND_DT AS DATE) AS ACTIVE_IND_DT
    FROM PERSON_ORGS_APVX_MV P
    delete from mv_capabilities_table;
    begin
    dbms_mview.explain_mview('PEOPLE.PERSON_MV_T16');
    end;
    select *
    from mv_capabilities_table where capability_name not like '%PCT%' and capability_name = 'REFRESH_FAST_AFTER_INSERT';
    I get the following error.
    CAPABILITY_NAME = REFRESH_FAST_AFTER_INSERT
    POSSIBLE = N
    MSGTEXT = tables must be identical across the UNION operator
    I wrapped them in CAST operations just to be sure they are the same type and size.

    As far as I'm aware, you can create MV in standard and also there is no limitation that I'm aware off
    Standard and Enterprise Edition
    A. Basic replication (MV replication)
    \- transaction based
    - row-level
    - asynchronous from master table to MV (Materialized View)
    - DML replication only
    - database 7 / 8.0 / 8i / 9i / 10g
    Variants:
    1. Read-only MV replication
    2. Updateable MV replication:
    2.1 asynchronous from MV to master
    2.2 synchronous from MV to master
    3. Writeable MV replication
    Enterprise Edition only
    B. Multimaster replication
    \- transaction based
    - row-level or procedural
    - asynchronous or synchronous
    - DML and DDL replication
    - database 7 / 8.0 / 8i / 9i / 10g
    - Enterprise Edition only
    Variants:
    1. row-level asynchronous replication
    2. row-level synchronous replication
    3. procedural asynchronous replication
    4. procedural synchronous replication
    C. Streams replication
    (Standard Edition 10g can execute Apply process)
    \- (redo) log based
    - row-level
    - asynchronous
    - DML and DDL replication
    - database 9i / 10g (10g has Down Streams Capture)

  • Question on MATERIALIZED VIEW and table

    HI
    there are table (name is test123) and MATERIALIZED VIEW (name also is test123) stored in the same schema (name is schema123).
    If I run sql : select from schema123.test123;*
    I wanna know the result data I get is data of table test123 or MATERIALIZED VIEW test123, which one of them?
    Thanks in advance!

    What is your database version?
    How did you even manage to create two objects with the same name?
    As I know, it is impossible, oracle will throw errors like below:
    SQL> create table FOO (str varchar2(5), num number(3,0));
    Table created.
    SQL> CREATE MATERIALIZED VIEW FOO
      2  BUILD DEFERRED
      3  REFRESH COMPLETE ON DEMAND
      4  enable query rewrite as
      5  select SUM(NUM)
      6  from FOO GROUP BY STR;
    from FOO GROUP BY STR
    ERROR at line 6:
    ORA-00955: name is already used by an existing object
    SQL>

  • Materialized view and Table

    Dear Friends,
    One quick question ..
    If the table name and materialized view name is same does truncating the data from table truncates materialized view too ?
    Thanks/

    CREATE TABLE "ABBREVIATION"
    "ABBREVIATIONID" VARCHAR2(36 BYTE),
    "ABBREVIATIONCODE" VARCHAR2(30 BYTE),
    "ABBREVIATIONTEXT" VARCHAR2(128 BYTE),
    "CREATIONDATE" DATE,
    "CREATEDBYLOGINID" VARCHAR2(36 BYTE),
    "LASTMODIFIEDDATE" DATE,
    "LASTMODIFIEDBYLOGINID" VARCHAR2(36 BYTE),
    CONSTRAINT "PK_ABBREVIATION1" PRIMARY KEY ("ABBREVIATIONID") TABLESPACE "KUMAR" ENABLE
    CREATE MATERIALIZED VIEW "ABBREVIATION" ("ABBREVIATIONID", "ABBREVIATIONCODE", "ABBREVIATIONTEXT", "CREATIONDATE", "CREATEDBYLOGINID", "LASTMODIFIEDDATE", "LASTMODIFIEDBYLOGINID") TABLESPACE "KUMAR" NEVER REFRESH
    AS
    SELECT "ABBREVIATION"."ABBREVIATIONID" "ABBREVIATIONID",
    "ABBREVIATION"."ABBREVIATIONCODE" "ABBREVIATIONCODE",
    "ABBREVIATION"."ABBREVIATIONTEXT" "ABBREVIATIONTEXT",
    "ABBREVIATION"."CREATIONDATE" "CREATIONDATE",
    "ABBREVIATION"."CREATEDBYLOGINID" "CREATEDBYLOGINID",
    "ABBREVIATION"."LASTMODIFIEDDATE" "LASTMODIFIEDDATE",
    "ABBREVIATION"."LASTMODIFIEDBYLOGINID" "LASTMODIFIEDBYLOGINID"
    FROM "ABBREVIATION" "ABBREVIATION";
    If I create a mv with a differnent name than that of a table does the truncation of data in table results in truncation of MV too ?

  • Dropping base table of materialized view

    HI please let me know what happens if i drop the base table of a materialized view? does the MV remain valid with data?

    Hi,
    Well, it's easy to test yourself.
    SQL> select count(*) from t1;
      COUNT(*)
           100
    SQL> desc t1
    Name                                      Null?    Type
    ID                                                 NUMBER(10)
    SQL> create materialized view t1_mv as select * from t1;
    Materialized view created.
    SQL> select count(*) from t1_mv;
      COUNT(*)
           100
    SQL> drop table t1 purge;
    Table dropped.
    SQL> select count(*) from t1_mv;
      COUNT(*)
           100
    SQL> desc t1_mv
    Name                                      Null?    Type
    ID                                                 NUMBER(10)
    SQL> select object_type, status from user_objects where object_name = 'T1_MV';
    OBJECT_TYPE         STATUS
    TABLE               VALID
    MATERIALIZED VIEW   INVALID
    SQL> select * from t1_mv where rownum < 5;
            ID
             1
             2
             3
             4
    SQL>I think the answer is very clear.
    Asif Momen
    http://momendba.blogspot.com

  • Materialized view refresh is very slow in production

    Hi,
    I am using Oracle 10.2.0.4.0 version and facing problem in Materialized view refresh in production.
    There is a set of Materialized views (15 Mviews) are refreshed through refresh group in production every week or adhoc basis. And for refreshing it is taking 5hrs. I have refreshed the same set of Materialized views multiple times in development environment through refresh group but it got refreshed within 3min. The structure of materialized base tables, type of materialized view refresh, materialized definition and volume of base tables are same between development and production. The production disk space also larger than development. But I am not sure why in production the refresh is very slow compare to development. As this is very critical can some one help on this?
    Thanks is advance.
    - Gopinath.

    Is it fast refresh Mviews? If yes, then check size of materialized view logs. Also check is any other mviews registered on those tables and not refreshing.
    select log_owner, master, log_table, REFRESH_method, version,
           owner, name as ragistered_snapshot, snapshot_site, current_snapshots last_refresh_time, sl.snapshot_id
    from dba_snapshot_logs sl,
         dba_registered_snapshots rs
    where sl.snapshot_id = rs.snapshot_id (+)
    order by 1,2,3 
    ;

Maybe you are looking for

  • What is the diff b/n sy-tabix,sy-subrc,sy-dbcnt

    hi experts can u help me for this

  • New to the Ipod World and Needing Help

    Im use to using the diffrent mp3 player's. I was hoping to know if its possible to sync music from Windows Media Player to the Ipod Nano 5th Generation. I tried and my Ipod says no music but its taking up space.

  • HR Report from infotype 0014

    Hi all, I have to make an HR report - using ALV preferrably - from infotype no 0014. The report should contain the following fields: emp no., empname, designation, emp sub group, wage type, amount and start date. Please let me know how to go about it

  • *I need help with MuVo2

    hi all.i dropped my mp3 player last day and now wheni turn it on i just can see creative > MuVo2 FM > then it hangs.when i put my ear on my mp3 i hear another sound from it's hard dri've.i went to it's recovery mode but it has no result.(some options

  • E mail message contains no characters( letters, numbers etc)

    When I want to read my mail, it appears to be empty. When I fwd it I can read the origional message. Also no appendixes can be read. Solution please