Materialized view log update question

Hi, I am running into a question regarding mview - not sure if it should behave that way or I didn't use it right.
I have two base tables, sales and customers (drived from nested materialized view example in oracle doc):
CREATE TABLE sales
cust_ID VARCHAR2(32 BYTE) NOT NULL,
amount_sold NUMBER,
TEMP VARCHAR2(100 BYTE),
CONSTRAINT sales_pk PRIMARY KEY (cust_id)
CREATE TABLE customers
cust_ID VARCHAR2(32 BYTE) NOT NULL,
CUST_LAST_NAME VARCHAR2(100 BYTE),
TEMP VARCHAR2(100 BYTE),
CONSTRAINT cust_pk PRIMARY KEY (cust_id)
CREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID (cust_id, amount_sold);
CREATE MATERIALIZED VIEW LOG ON customers
WITH ROWID (cust_id, cust_last_name);
Then I create a fast refresh materialized view based on them:
CREATE MATERIALIZED VIEW join_sales_cust
REFRESH FAST ON DEMAND AS
SELECT c.cust_id, c.cust_last_name, s.amount_sold, s.rowid srid, c.rowid crid
FROM sales s, customers c
WHERE s.cust_id = c.cust_id;
Since this materialized view only invole cust_id and amount_sold from sales and cust_id and last_name from customers table, I do not want to trigger materialized view log entry if the TEMP column value gets updated. So follow update shouldn't trigger mlog:
update sales set TEMP='TEMP2' where cust_id=1
but this update should:
update sales set amount_sold=3 where cust_id=1
What I am seeing happenning is any update on the base table will triger mlog entried regardless whether the column is involed in the materialized view or not.
Can someone please confirm if this is the correct behavior and whether there is a way to accomplish what I wanted to do?
Thank you!
Edited by: user3933488 on Jan 8, 2010 12:53 PM

You created the materialized view logs with some columns, which is not necessary when creating a join MV on top of them. You can happily skip those in your MV log definition. And then it becomes clear that those columns are not involved in the decision whether a MV log needs to be updated or not. Everything that happens to the base table gets recorded. The "WITH ROWID" and "INCLUDING NEW VALUES" and the column list only specify WHAT should be recorded when something changed.
Regards,
Rob.

Similar Messages

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

  • Performance consequences to adding materialized view logs to tables?

    I am writing a very complex query for a client of our transactional database system and this will require the creation of a materialized viewbecause all attempts at tuning to make performance acceptable have failed.
    I want to enable fast refresh of the MVIEW but I am confused regarding the consequences of the addition of adding materialized view logs to the base tables.
    Some of the tables are large and involved in alot of transactions and I am wondering if the performance of INSERT/UPDATES will be seriously affected by the presence of an mview log.
    This may be a simple question to answer but I was unable to find a clear cut answer in the literature.
    Thanks for any answers!!
    Chris Mills
    Biotechnology Data Management Consultant

    Last time i looked into this there were three cases to consider
    If you're doing conventional row-by-row DML then the impact is just one insert into a heap table per row modified.
    If you are modifying a high number of rows using bulk-binds then the overhead is very severe because modifying 1,000 rows on the base table causes 1,000 non-bulk bound inserts into the log table.
    Direct path inserts have extremely low overhead because the MV log is not touched. Instead, the range of new rowids added is logged in ALL_SUMDELTA
    http://oraclesponge.wordpress.com/2005/09/15/optimizing-materialized-views-part-ii-the-direct-path-insert-enhancement/

  • Creating a Materialized View Log After the Data has been instered

    Hi,
    I am trying to create a method of replication from Oracle to MySQL using the Materialized View Log table.
    This has been done before and works quite well, the only problem is that I am trying to impliment the log after the table has been created and populated and wish to push all the existing data through the log file...
    Does anyone know if it is possible to refresh the Materialized View Log and not a Materialized View.
    The way the replication is intended to work is:
    Oracle> Data inserted into table
    Oracle> writes the vector data to the MVL
    Script> Monitors the MVL and can see the changes being made to the Oracle Table
    Script> Updates MySQL with the data and removes the rows from the MVL
    MySQL is then used with other unix systems
    Currently we export the data from the table using Triggers and a cronjob running every x minute to check for changes in the TriggerTables
    Many thanks for your time on this, I have been checking for almost a whole working day and not found the answer to this problem.

    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.

  • Creation of Materialized view and Materialized view log.

    I wanted to create materialized view with 'REFRESH FAST ON COMMIT' option.
    1) Table1 --it is partitioned range + list -- Added primary key
    2) view1   -- having primary keys on view's base table
    Steps:
    1) create materialized view log on Table1 ; -- default primary key
    2) create materialized view log on view1.  --- It is giving below error.
    ORA-00942: table or view does not exist
    i wanted to create Materialized view like below
    create materialized view
    REFRESH fast ON commit
    as
    select ...
    ... from table1
    where c1 in (select c1 from view1 where ... );
    Question:
    1) As i am getting above error while creating MV log on view. Can we create MV log on view or we have to create MV log on view base table?
    2) To create MV with ''REFRESH FAST ON COMMIT' option , do we need to have primary key on master tables? 
    Any pointers on this will really helpful.
    Thanks
    Prasad

    Also created MV LOG on 3 tables and tried with joins ..
    create materialized view
    REFRESH fast ON commit
    as
    select ...
    ... from table1 , tab2 t2,tab3 t3
    where ....
    and ...
    Get same error ORA-12052: cannot fast refresh materialized view AVSYS.EVENT_LOG_MV
    2052. 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.

  • Materialized View Logs in a logical standby database

    I am trying to create materialized views based on a few tables in a logical standby database.
    The target database (11g R2) where the MVs will be created is a stand-alone database.
    The DB where the base tables reside is a logical standby database (11g R2).
    The requirement is to do a "FAST REFRESH" of the Materialized Views.
    My questions are :
    1. Can I create MV logs in the logical standby DB?
    2. If the answer to question no. 1 is "Yes", do I need to do anything different or configure the logical standby DB in a specific manner in order to create MV logs. From what I understand, the objects in the logical standby database are in a locked state. Is that going to be a problem ?
    Any other information that might be relevant is greatly appreciated.
    Thanks in advance.

    HI Daniel,
    I appreciate your quick response.
    My choice of name may not have been ideal, however changing new to another name - like gav - does not solve the problem.
    SYS@UATDR> connect / as sysdba
    Connected.
    SYS@UATDR>
    SYS@UATDR> select name, log_mode, database_role, guard_status, force_logging, flashback_on, db_unique_name
    2 from v$database
    3 /
    NAME LOG_MODE DATABASE_ROLE GUARD_S FOR FLASHBACK_ON DB_UNIQUE_NAME
    UATDR ARCHIVELOG LOGICAL STANDBY ALL YES YES UATDR
    SYS@UATDR>
    SYS@UATDR> create tablespace ts_gav
    2 /
    Tablespace created.
    SYS@UATDR>
    SYS@UATDR> create user gav
    2 identified by gav
    3 default tablespace ts_gav
    4 temporary tablespace temp
    5 quota unlimited on ts_gav
    6 /
    User created.
    SYS@UATDR>
    SYS@UATDR> grant connect, resource to gav
    2 /
    Grant succeeded.
    SYS@UATDR> grant unlimited tablespace, create table, create any table to gav
    2 /
    Grant succeeded.
    SYS@UATDR>
    SYS@UATDR> -- show privs given to gav
    SYS@UATDR> select * from dba_sys_privs where grantee='GAV'
    2 /
    GRANTEE PRIVILEGE ADM
    GAV CREATE TABLE NO
    GAV CREATE ANY TABLE NO
    GAV UNLIMITED TABLESPACE NO
    SYS@UATDR>
    SYS@UATDR> -- create objects in schema
    SYS@UATDR> connect gav/gav
    Connected.
    GAV@UATDR>
    GAV@UATDR> -- prove ability to create tables
    GAV@UATDR> create table gav
    2 (col1 number not null)
    3 tablespace ts_gav
    4 /
    create table gav
    ERROR at line 1:
    ORA-01031: insufficient privileges
    GAV@UATDR>

  • Reg  ora-12034 materialized view log on younger than last refresh

    Hi,
    when i update my base table materialized view log shows the updated rows
    but when i refresh materialized view it wont show updated rows in materialized view and also there is no rows in materialzed log
    it shows error ora-12034: materialized view log on younger than last refresh
    cheers,

    FIX
    A complete refresh is required before the next fast refresh.
    Please run the process "Refresh Materialized Views"

  • ORA-12096: error in materialized view log

    Hi All,
    I had created a fast refresh materialized view. Log was also created.
    Now i dropped the mv and the logs.
    But now every time i update or insert into this customer table i get error message.
    ORA-12096: error in materialized view log on Customer
    ORA-00942: table or view does not exist
    There are entries in the DBA_MVIEW_LOGS for customer table.
    Please suggest.

    Hi,
    What database version are you on?
    And do you have access to Metalink/My Oracle Support?
    Found this, by the way:
    ORA-12096: error in materialized view log on <table>
    If problems occur when you try to access a log file for a materialized view, the system issues an ORA-12096 error message which is followed by the actual error. If the ORA-12096 error message is accompanied by an ORA-00942 message, the problem may be due to an online reorganization that was only partially undone. In this case, you can drop the log file for the materialized view manually (after you have verified that it is no longer required):
    DROP MATERIALIZED VIEW LOG ON <table>;
    Edited by: hoek on Jul 29, 2009 2:15 PM

  • ORA-12096: error in materialized view log on a table

    Hi while updating a table getting below error
    ORA-12096: error in materialized view log on "FII"."FII_GL_JE_SUMMARY_B"
    What might be the problem.
    Thanks.

    might be table definition has changed, you may need to drop the mview log and recreate it.

  • 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

  • Materialized view log and user....

    Hi,
    Assume that a user , let's call him A owns a table and another user B needs to create a materialized view log on the table who owns the A user.
    Whereas the user B do have all object privileges(direct priv insert, update, delete.. not via a role) on the table of user A he cannot create a mv log on this table on his schema....
    So, the stmts insert/update/delete on <tab_name> are successfully executed (having connected as user B).
    The error message "ORA-00942: table or view does not exist " appears when i issue the command:
    connect B/B;
    create materialized view log on tab_name with sequence including new values;
    Note: I use ORADB 10.2.0.4 and there is a synonym of tab_name to the user B (who tries to create the mv log on)...
    Is the above req. possible in any way...???
    Thank you,
    Sim

    The documentation says the following:
    The materialized view log is created in the same schema as the target master.HTH!

  • Will Materialized view log reduces the performance of DML statements on the master table

    Hi all,
    I need to refresh a on demand fast refresh Materialized view in Oracle 11GR2. For this purpose I created a Materialized view log on the table (Non partitioned) in which records will be inserted @ rate of 5000/day as follows.
    CREATE MATERIALIZED VIEW LOG ON NOTES NOLOGGING WITH PRIMARY KEY INCLUDING NEW VALUES;
    This table already has 20L records and adding this Mview log will reduce the DML performance on the table ?
    Please guide me on this.

    Having the base table maintain a materialised view log will have an impact on the speed of DML statements - they are doing extra work, which will take extra time. A more sensible question would be to ask whether it will have a significant impact, to which the answer is almost certainly "no".
    5000 records inserted a day is nothing. Adding a view log to the heap really shouldn't cause any trouble at all - but ultimately only your own testing can establish that.

  • Materialized View Logs

    Hi, I need some help understanding MV Logs. The information I find on MV Logs, is very basic, ie. the general syntax of creating a log, the types of logs, how they are refreshed etc.
    Let me put my question this way. I want to create an MV, with a where clause that joins 3 tables. This should be simple enough. But how does the LOG(s) work ? Is there an MV Log for each table in the where-clause of the select statement ?
    And, is there only 1 way of creating an MV Log? CREATE MATERIALIZED VIEW LOG ON mis.prov_cat_link with .......
    Can't I specify the columns I want to "log" ? What if the select statement in my MV create statement only selects certain columns, and not all ? Maybe if I understand how the log works, I will understand the logic behind it, and how to create it.
    I hope the above makes sense !

    Using the WITH clause you can provide filter columns that are stored in the MV log.
    Mike

  • Materialized view logs pretty huge!

    Hi,
    I have a table MLOG$_XXXXX, which i guess is a materialized view log table. It is huge in size (80GB) and is growing at a very alarming rate.
    Could someone please help me to reduce the size of this table?
    How do I find out which materialized view is causing this table to grow? Is there any query through which I can find this out?
    The database is of version 10204 and is running on HP Unix (B.11.11).
    Thanks!

    The materialized views in the database are:
    SQL> select mview_name, owner, updatable, refresh_mode, last_refresh_date from dba_mviews;
    MVIEW_NAME                     OWNER      U REFRESH_MODE    LAST_REFRESH_DATE
    MV_EXCH_RT                     SYS        N COMMIT          03 JUN 2010 12:02:59
    ADMIN_MGMT_CO                  JJORA      N DEMAND          06 JUL 2010 01:37:39
    REG                            JJORA      N DEMAND          06 JUL 2010 01:37:39
    CNTRY                          JJORA      N DEMAND          06 JUL 2010 01:37:39
    OPER_GRP                       JJORA      N DEMAND          06 JUL 2010 01:37:39
    ADMIN_CO                       JJORA      N DEMAND          06 JUL 2010 01:37:39
    MV_JJGL_SUB_CD_141P            JJGL       N DEMAND          06 JUL 2010 01:24:43
    7 rows selected.The table which grows at an alarming rate is:
    SQL> select sum(bytes)/1024/1024/1024 from dba_segments where segment_name like 'MLOG$_XXXXX%';
    SUM(BYTES)/1024/1024/1024
                   77.8789063Now how do I find out, which materilized view is causing this table to grow? Can someone please provide me the query?
    Thanks!
    Edited by: user9104898 on Jul 6, 2010 8:11 AM

Maybe you are looking for

  • Cost of goods sold (cogs) for non-shippable items (intangible items)

    Hi Experts, Can anyone please help me on this issue for shippable item we can check in material transactions--distributions for cogs account and cost of an item. But how can we check the cost and account for non-shippable items (intangible items) wit

  • Services in sap pi

    Hello All, Some of the services are not active in SICF transaction in PI. If I make the servcies active then do I need to restart/reset the PI server? Please tell me if there is any sap note on this... Regards, Moorthy

  • Linking data across PDF's in a portfolio

    Morning All, I am looking for a way to be able to copy data input into a form in one PDF in my portfolio and have it appear in mutliple other forms sharing the same fields. For example I have a portfolio full of forms to be filled by our clients, man

  • Same Code in ordinary view and Materialised View is performing differentl

    I am currently working on a Data Warehouse Project hooked off the back of an accounting system. It takes data from an old system and data from a new system and uses both for Corporate Reporting. For Historical and Legacy Reporting reasons it is neces

  • How can I print from Firefox using my Epson Workforce 610 printer?

    I call technical support at Epson regarding my Workforce 610 printer because I'd tried to print out an e-mail using my Mozilla FireFox web browser. During the conversation with Epson technical support I learned that my printer does in fact work and w