Oracle Streams vs. Updatable Materialized View

Does anyone have an idea in which cases Oracle Streams is better than Updatable MV or visa verse?

Are you really talking about Updatable Materialized Views? Or multi-master replication? Personally, I'm rather hard-pressed to come up with a situation where updatable materialized views would be useful unless you're taking the next step and doing multi-master replication.
In general, Streams is going to put less load on the source system than materialized views and is going to replicate data more quickly. The downside tends to be that it's a relatively new technology, so it's not appropriate for environments that have older versions of Oracle. Going along with that, you'll find a lot more people/ organizations/ setups using materialized views than Streams, which can be a good thing if you need to hire new staff/ get support from a local user group/ etc. Streams also tends to be more flexible, which can be a good thing, but also tends to make things a bit more complicated.
If you can outline the particular problem you're trying to solve, we can probably be a lot more specific...
Justin

Similar Messages

  • 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- error with CREATE_SNAPSHOT_REPGROUP

    I'm trying to create an updatable materialized view from the replication administrators account (REPADMIN). I use the assistant and in the third step (after creating the replication group and the materialized view), when the materialized view is going to be added to the group, I got this error:
    ERROR in line 1:
    ORA-01403: No data found
    ORA-06512: in "SYS.DBMS_REPCAT_SNA_UTL", line 5927
    ORA-06512: in "SYS.DBMS_REPCAT_SNA", line 82
    ORA-06512: in "SYS.DBMS_REPCAT", line 1332
    ORA-06512: in "SYS.DBMS_REPCAT", line 1307
    ORA-06512: in line 2
    I have also tried to use the command file that the assistant generates (I add below), and the error is triggered within the CREATE_SNAPSHOT_REPOBJECT procedure.
    Has anybody any idea to resolve the problem?
    Thanks in advance
    BEGIN
    DBMS_REPCAT.CREATE_SNAPSHOT_REPGROUP(
    gname => '"MYGROUP"',
    master => 'DB.DOMAIN.COM',
    propagation_mode => 'ASYNCHRONOUS');
    END;
    CREATE SNAPSHOT "MYUSER"."MYTABLE"
    REFRESH COMPLETE WITH ROWID
    FOR UPDATE
    AS SELECT "COD", "NAME" FROM
    "MYUSER"."MYTABLE"@DB.DOMAIN.COM c
    BEGIN
    DBMS_REFRESH.ADD(
    name => '"MYUSER"."REF3"',
    list => '"MYUSER"."MYTABLE"',
    lax => TRUE);
    END;
    BEGIN
    DBMS_REPCAT.CREATE_SNAPSHOT_REPOBJECT(
    gname => '"MYGROUP"',
    sname => '"MYUSER"',
    oname => '"MYTABLE"',
    type => 'SNAPSHOT',
    min_communication => FALSE);
    END;

    Hello,
    These days I have had some problems with my forum-account and I haven't been able to connect and reply.
    Regarding to your doubt, the name of refresh group was correct, and as I see, the problem can't be related to the refresh group.
    While the problem with my account was resolved, I created two new databases (*) and the problem within the materialized view process is disappeared. I suppose that my first original databases were degraded, but I don't know where.
    (*) of course, I could do that because I use Oracle in an academy institution, not for production, thank God
    Anyway, for now I will give up here. Thanks for your help.
    Regards,

  • 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

  • Updatable materialized views.

    Hi ,
    I am using sqlplus.
    Please can anyone share a simple example to update a base table using a updatable materialized view.
    Thanks

    usera :- Contains the base table tab1.
    userb:- Contains the materialized view
    materialized view create query in userb:-
    CREATE MATERIALIZED VIEW MV_UPDATETAB1
    REFRESH on demand
    FOR UPDATE
    AS
    SELECT * FROM  USERA.TAB1
    MView created.
    Tab1 has 4 rows existing.
    I added one more row to the mview.
    select * from mview shows 5 rows. (base table 4 rows)
    Then I refreshed the mview :-
    exec DBMS_MVIEW.REFRESH('mv_updatetab1','c')
    successfully executed.
    Base table still has 4 rows.
    The mview alos has 4 rows and the newly added is not present in the table and mview either.
    Any thoughts and suggestions

  • Database replication with updatable materialized view in oracle 10gR2

    I neet to set up 1 central server and two local databases ....the local database will hold materialized view....now how to replicate data...in this scenario...please help as soon as possible...i am in rush.....
    the database i use is oracle 10g Release 2
    Edited by: user9932019 on Sep 4, 2009 2:25 AM

    It's not a process that can be explained in a forums posting. You have to understand the steps.
    Here are some other examples :
    http://www.orafaq.com/wiki/Scripts#Oracle_Advanced_Replication_Scripts

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

  • 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

  • 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

  • Complex Oracle Streams issue - Update conflicts

    This is for Oracle streams replication on 11g r2.
    I am facing update conflicts in a table. The conflict arise due to technical and business logic issue. The business logic will pass through the replication/apply process successfully but we want to arrest and resolve it before replication for our requirements. These are typically a bit complex cases and we are exploring the possibility of having both DML handlers and Error handlers. The DML handlers will take care of business logic conflicts and Error handler for technical issues before pushing it to Error queue by Streams. Based on our understanding and verification, we found a limitation to configure both procedure DML handler and Error handler together for the same table operation.
    Statement handlers can not be used for our conflict scenarios.
    Following are my questions:
    1. Have anyone implemented or faced such a scenario in their real time application? If yes, can you please share some insights or inputs?
    2. Is there a custom way to handle this complex problem of configuring both DML and Error handler?
    3. Is there any alternative possible way to resolve this situation at Oracle streams environment with other handlers?

    Dear All
    I too have a similar requirement. Could anyone help with one?
    We can handle the error-ing transactions via Error Handler procedures.
    But we can not configure the DML handler procedure for transactions that are successfully replicated. STreams does not allow us to configure a handler for this. Is there any other handler / procedures / hooks in streams where we can implement the desired functionality - which includes changing the values in the LCR before invoking lcr.execute() and we should be able to discard the LCR also if required.
    Regards
    Velmurugan
    Edited by: 982387 on Jan 16, 2013 11:25 PM
    Edited by: 982387 on Jan 16, 2013 11:27 PM

  • Oracle Reports 6i w/ Materialized Views

    Is Oracle Reports 6i integrated with Materialized Views? If so, is there a patch out there so the query builder will see them? The query is fine in Sql+ but Reports doesn't recognize the materialized views. What is the fix?

    hello,
    when you paste the query into the sql-window it should work. only the query-builder-tool does not pick them up.
    regards,
    the oracle reports team

  • Oracle Text Index on Materialized View

    Hello,
    I have designed a search engine for an internet application.
    We have different tables for our main business objects, the search is based on the content of all these dependent entities (Product, Company etc...)
    So I have created a materialized view to embody this aggregation.
    Then I have created a Multi column datastore index on top of the snapshot.
    The search engine has to be refreshed automatically 3 times a day, and manually anytime.
    This is achieved by executing a complete refresh on the view and rebuild the index, programmatically via Toplink (SqlCall).
    The MV refresh looks like this :
    alter index usr_batiprod.fullTextMulticolIdx rebuild
    and the index rebuild:
    begin
    DBMS_MVIEW.REFRESH('FT_TEST','C');
    end;
    Everything was fine until now, we have had lots of tuning on the index side, the refresh process was working fine...
    We have let the users access the engine since Thursday (the index had been created on the production environment a fews weeks ago) and since yesterday (or maybe before) we have been experiencing data incoherency on the index...
    I've tracked down the pb to the Fulltext Search's refresh process (manual and automatic share the same code) that was crashing on the Materialized view refresh :
    java.sql.SQLException: ORA-20000: Oracle Text error:
    DRG-50610: internal error: drexdsync
    DRG-50857: oracle error in drekrtd (lob erase)
    ORA-00060: deadlock detected while waiting for resource
    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
    Again, we had tested the functionality thoroughly and never experienced such behaviour before... even while refreshing the materialized view and the index 3 times (or more) a day..
    Once I dropped the Oracle Text Index, I was able to refresh the MV again..
    so it looks like the index was in some incoherent state and was holding a lock on the materialized view...
    Maybe my Index refresh call is wrong, and a stronger load on the functionality leads quickly to this pb, I dont know..
    I had always been a bit doubtful towards my index rebuild call, so Im thinking about using a more complete call :
    alter index usr_batiprod.fullTextMulticolIdx rebuild parameters ('sync')
    is it enough, or do I have to switch to a 'Oracle Text' specific call ?
    Is there another possible reason for the MV lock ?
    Thank you for your support
    Best Regards
    Olivier Cuzacq

    MVs are constructed in different ways and have lots of different uses.
    Why not just use MV as temp table for OT (Oracle Text) index?
    Refresh MV OT_TEMP.
    Delete all not matching rows from OT.
    Insert all missing missing rows from OT_TEMP to OT.
    sync OT index (online).
    Query table OT.

  • Updatable materialized view site - replication

    Hi all,
    I have a shared instance database (with multiple schemas) hosting different applications for different customers. I'm now going to move out one of the application - the materialized view site to another database in new server. (as per request by customer to another data center) by using schema level import/export. The master site will remain untouched.
    As i'm rather new in replication, I would like your advise in which data dictionary tables where I can find which are the schemas having the below privileges. As this is a legacy database handed over to us long back, i need to dig out all the info to plan for the migratiion. I need to identify which schema is taking part in the snapshot replication in the mview site as there are 20 over schemas in the database. Can anyone advise me? Kindly provide addtional info if u think it helps.
    grant_admin_any_schema
    privilege_type => 'proxy_snapadmin'
    privilege_type => 'receiver'
    privilege_type => 'propagator'
    thanks

    dba_sys_privs

  • Updatable Materialized View Example

    Hello,
    I am using Oracle 11.2.0.1 on Windows OS. I am looking an example of updatable MV something like this :
    Table1
    id
    col1
    col2
    col3
    col4
    Table2
    id
    col2
    col3
    Table3
    id
    c1
    c4
    c5
    I need an updatable MV which joins all these 3 tables based upon ID column something like this :
    id,table1.col2,table1.col4,table2.col3,table3.c4,table3.c5
    id,mvcol1,mvcol2,mvcol3,mvcol4,mvcol5
    and if user says :
    update MV set mvcol2=somevalue, it should also be updated in the parent table(s). Is it possible please?
    if user says :
    insert into mv values (....), new rows should be in the parent table, and if user says delete mv where id=some value, then all rows from parent table should be deleted.
    Thanks.

    user12050217 wrote:
    Hello,
    I am using Oracle 11.2.0.1 on Windows OS. I am looking an example of updatable MV something like this :
    Table1
    id
    col1
    col2
    col3
    col4
    Table2
    id
    col2
    col3
    Table3
    id
    c1
    c4
    c5
    I need an updatable MV which joins all these 3 tables based upon ID column something like this :
    id,table1.col2,table1.col4,table2.col3,table3.c4,table3.c5
    id,mvcol1,mvcol2,mvcol3,mvcol4,mvcol5
    and if user says :
    update MV set mvcol2=somevalue, it should also be updated in the parent table(s). Is it possible please?
    if user says :
    insert into mv values (....), new rows should be in the parent table, and if user says delete mv where id=some value, then all rows from parent table should be deleted.
    Thanks.You can create a writable or updateable MV by using the FOR UPDATE clause when you create it - but changes will not be replicated back to the source table(s). It is up to the developer to figure out how to do this. One way to do this is to manually update the source items along with the MV. Another possibility is to use triggers to copy the changes back to the source table.

  • Materialized view Vs Streams - can you recommend one?

    We have many materialized views (for change data capture) based on rowid as the source doesn’t have primary keys. The source DB will be upgraded to 10/11g (from 9). Because the data would be exported and imported back, the rowids will be changed at the source.
    Consequently, the materialized views at the target need to be rebuilt. However, it is impossible to rebuild the materialized views timely due to huge volume.
    We are thinking about using Oracle Streams instead of materialized views. Any advice would be greatly appreciated.
    hb

    With streams, primary are not require but your updates are not guarantee. If you have duplicates in your data, it will updates both which may or may not be what you want. BTW. Streams will not replicate table with rowid. I am assuming those rowid were required because you are outer joins with MVs.
    If you want to stick with MVs, you can take exports of the tables, import after the upgrade and build the MVs with the prebuilt table option. It's a lot quicker then trying to recreate the MV or doing complete refresh over the WAN.

Maybe you are looking for