Help understand materialized views

I inherited a few db instances that were extensively using materialized views. To be honest, I've never had to configure or use materialized views, and I wonder if my logic on them is correct.

Host instance
The Materialized View logs live here

Instance of the target
Materialized views are living here.
When you want your updated data you run here but all of the activity is on the Pb of the host.

My real question here is I is more necessary than materialized views and I just want to take them off. I recloné the target instance, so all materialized views have been blown away. Should I just delete the materialized view logs to completely remove it from my environment? Or is their something more needs to be done.

Thank you

>
My real question here is I is more necessary than materialized views and I just want to take them off. I recloné the target instance, so all materialized views have been blown away. Should I just delete the materialized view logs to completely remove it from my environment? Or is their something more needs to be done.
>
That's all you need to do. If you used the REFRESH GROUPS, you can remove those and if you have any DBMS_JOBs that were used to update the MVs you won't need those most.

Naturally all code referenced directly newspapers MV or the MVs themselves will have to be amended to remove the references.

Tags: Database

Similar Questions

  • I'd like to preserve all materialized views.

    Hi all
    I need help on materialized views. Business users want monthly snapshot on some tables in the database. The problem is that they want to keep all the snapshots even after refresh. Is it possible to keep all snapshots.
    Can I join the new instant result of the old snapshot with a new column for the month month when snapshot was updated.

    Increasingly, I create folders in the discoverer, for these monthly snapshots, that's why I want that all the results in one place. Otherwise, I know I could create new table each month to keep all the results, since the old snapshot.

    Gurus, please help.

    You must write a procedure to add data to your own table, but it should be a reasonably small piece of code. You can schedule to run every month via the DBMS_JOB and DBMS_SCHEDULER package.

    Justin

  • Materialized view error - need help

    Hi friends

    We have a table named weight_slip in two different places database running independently and that we need to combine these two places in a single central server table records. To this end, we try to use the view with a primary as a materialized bin code key. Below mentioned is Materialized View Query (Park and ang are 2 different oracle db).
    select * from weight_slip@park
    union
    select * from weight_slip@ang;
    We get the following error

    ORA-12015: cannot create a view fast refresh materialized by a complex query

    Please suggest a way to overcome this error or suggest any other way to get this job

    Concerning
    Park

    Hello

    You perform a UNION - a set based operations with a unique genre that prevents him from being eligible to fast refresh. You should be able to do a full refresh, however.

    David

  • need help on the name of the column in double materialized view ORA-00957

    I have a query, long enough and several (8ways) joins.

    When I run it as a SQL query, it is fine.

    When I add create materialized, view myViewName it errors with
    ORA-00957: duplicate column name.

    How is there is no problem when executing the SQL statement, and how to fix this?

    Thank you.

    Hello

    Columns in a query do not need a unique name:

    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    D D
    - -
    X X
    

    At least not in SQL * Plus; other front ends might oppose it.
    In previous versions of Oracle, subqueries (such as online views) does not need to have unique names, but you've got an error if you tried to reference a non-unique column (and it is unnecessary to have the column if never reference you).

    Columns in a table or a view need unique names:

    CREATE OR REPLACE VIEW view_x
    AS
    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    ,     dummy
          *
    ERROR at line 4:
    ORA-00957: duplicate column name
    
  • Materialized view Questions PLZ HELP!

    Hi all

    How to check the time required for a materialized view to run at a given time.
    My point of view materialized is a full refresh that runs automatically at 03:00.

    (a) I interviewed dba_jobs and dba_mview_refresh_times and matched the last_date and last_refresh to find the total time. How can I know that 80 JOBS matches my opinion MVIEW_UNION in a much easier way?

    SQL > select job, last_date, order dba_jobs total_time in last_date;
    WORK LAST_DATE TOTAL_TIME
    ---------- ----------------- ----------
    80 05/05/10 03:00:02 5255

    SQL > select name, last_refresh from dba_mview_refresh_times where owner
    NAME LAST_REFRESH
    ------------------------------ -----------------
    MVIEW_UNION 05/05/10 03:00:02



    (b) also is total_time time it took the request to run today at 03:00, that is to say he started at 03:00 and ended at all about 4:45(3+5255_msec) or is it the time it has taken since the day wherever it has been planned in dba_jobs (IE back of 1 week)

    (c) also my dosent table source contain all indexes and I created indexes on the materialized view, I want to know if the full update will recreate the indxes.

    Thanks in advance,
    Kind regards

    Index on the MV are independent of indexes on the tables in the source.

    The "container" for a MV is a table. Therefore, indexes can be created on this topic.
    A FULL refreshment made with ATOMIC_REFRESH set to FALSE would be a TRUNCATE and INSERT APPEND. The index may be updated at the end.
    A FULL refreshment made with ATOMIC_REFRESH set to TRUE would be a DELETE and INSERT. This, as it is, has notable requirements of Undo (and redo). Index, if any, would also add many more requirements Undo (and redo) and updating.
    A QUICK update is an UPDATE or INSERT. Again, the presence of indexes can have an impact. If the discount is small (ie. the proportion of the updates/news lines is low compared with the lines already present in the MV), then the index can be kept because they are (the overhead of recreating the index i would exceed overload time and undo/redo of the DML with the present indices). However, if the QUICK updates/inserts many rows update, a strategy of DROP and CREATE better index.

    Hemant K Collette
    http://hemantoracledba.blogspot.com

  • How to understand where are the data in a materialized view, coming from

    HI: when I run select NAME, OWNER of dba_mview_refresh_times, I see a number of materialized views. How can I find more information on this view it's source data and fields. The source in a different database table has changed. But the view on my database where the materialized view has not changed. I want to confirm origin of data in this view

    TIA
    Ravi

    Take a look at the column of the QUERY to the DBA_MVIEWS view.

  • help a single master more editable site materialized views

    Hello world

    I have a solution in which I have 5 sites.
    I decided to implement a single site of master with 4 updatable materialized view sites.
    The reason why I made this decision, it's I want that if my main site does not work, the materialized view sites don't update with other data.
    My question is in this situation if the main site became unavailable can be update view materialized sites update their own individually and after master site data become available, they send their data to that or not, they can query just to their own database until the main site are available?

    Thank you

    Hello

    Yes, what you think is correct. Mviews update can run locally even if the primary site is unavailable. She can push further data on the master site when the main site is available.

    The mviews update can be updated even if the primary site is unavailable. But the changes that happened on the site controller is not updated until it becomes available and an update is performed.

    Thank you
    Florent

  • Trigger on the materialized view

    Hello

    I have the scenario based (Database 11 g):

    There is a view materialized (PERSON), which contains the ID and NAME fields. This MV is update daily with a fast refresh.

    I have a second array (NAMES), with ID and NORM_NAME. This table contains the name of the person, without special characters.

    For example, for recording / * 1 BJORN * / in the PERSON table

    I would check * 1 BJORN * / in table NAMES.


    Problem is how to fill the NAME table after the filling of the materialized view.

    I used a trigger AFTER INSERT or update, as described below, but even if I update the master table (for this purpose, update the MV), I have only to trigger inserts.


    Is there a way to implement a trigger "after update" on a materialized view, or do I need another approach?


    /*


    create or replace TRIGGER TRG_TESTE_MV

    AFTER INSERT OR UPDATE ON THE PERSON

    REFERENCING OLD AS OLD AGAIN AS NEW

    FOR EACH LINE

    BEGIN

    IF THE INSERTION

    INSERT THE NAMES

    VALUES

    (: NEW.id,:NEW.NAME);

    END IF;

    IF THE UPDATE CAN

    UPDATE OF NAMES

    SET NAME =: NEW.NAME WHERE ID =: NEW.id;

    END IF;

    END;

    */

    Thanks for any help

    Your trigger fires, but I doubted that you will be satisfied with the results. You really need to understand how to refresh process works before you begin creating triggers of MV:

    SQL > create table emp1 in select * from EMP
    2.

    Table created.

    SQL > create materialized view emp1 with rowid journal
    2.

    Materialized view log that is created.

    SQL > create materialized view emp1_mv
    2 fast refresh
    3 on request
    4 with rowid
    5 as
    6 select * from emp1
    7.

    Materialized view created.

    SQL > create or replace
    trigger 2 emp1_mv_biudr
    3 before inserting
    4 or update
    5 or delete
    6 on emp1_mv
    7 for each line
    Start 8
    9 insert then dbms_output.put_line ('INSERT' |: new.ename); end if;
    10 if the deletion then dbms_output.put_line ('REMOVE' |: old.ename); end if;
    11 end;
    12.

    Trigger created.

    SQL > insert
    2 in emp1 (empno, ename, sal)
    3 values(1,'X',1000)
    4.

    1 line of creation.

    SQL > validation
    2.

    Validation complete.

    SQL > set serveroutput on
    SQL > exec dbms_mview.refresh ('emp1_mv', 'f');
    INSERTION OF X

    PL/SQL procedure successfully completed.

    SQL > update emp1
    2 set sal = sal + 1
    3 where ename ('King', 'JONES')
    4.

    2 lines to date.

    SQL > validation
    2.

    Validation complete.

    SQL > set serveroutput on
    SQL > exec dbms_mview.refresh ('emp1_mv', 'f');
    INSERTION OF JONES
    INSERTION OF KING

    PL/SQL procedure successfully completed.

    SQL > delete emp1
    2 where in ename ('ALLEN', 'SMITH')
    3.

    2 deleted rows.

    SQL > validation
    2.

    Validation complete.

    SQL > set serveroutput on
    SQL > exec dbms_mview.refresh ('emp1_mv', 'f');

    PL/SQL procedure successfully completed.

    SQL >

    As you can see, refresh MV updates ever. Results update underlying table to remove/insert in MV. That's why your trigger will not give the results that you expected.

    SY.

  • tabletop pre-constructed - materialized view Refresh

    Hi all

    Please help me to learn how to work with the materialized on pre-constructed table view.

    I created the table predefined:

    CREATE TABLE 'MISS '. "" TMP003 ".

    (

    "ITEM_ID" NUMBER (10.0)

    ) ;

    I created a materialized on predefined table view:

    CREATE A MATERIALIZED VIEW "MISS." "' TMP003 ' ('ITEM_ID')

    ON PREBUILT TABLE

    AS SOME "COST_DETAIL_ITEMS". "' ITEM_ID ' 'ITEM_ID' TO 'MISS '. "COST_DETAIL_ITEMS"@EFLP2. EFLATBED.COM 'COST_DETAIL_ITEMS ';

    I checked the amount of lines to the original source object:

    SELECT count (1) you cnt OF 'MISS '. "COST_DETAIL_ITEMS"@EFLP2. EFLATBED.COM 'COST_DETAIL_ITEMS ';

    CNT

    -----

    61047571

    I checked the amount of lines to the object of my result:

    Select count (1) cnt of 'MISS '. "" TMP003 ".

    CNT

    ----------

    0

    I tried to update the object with the result:

    DBMS_MVIEW exec. REFRESH('RATER.) TMP003');

    anonymous block filled

    I checked the amount of lines to my profitability after trying to update:

    Select count (1) cnt of 'MISS '. "" TMP003 ".

    CNT

    ----------

    0

    Please help me understand how to refresh my result object properly.

    Thank you.

    You will need to start by filling out the basic pre-built using table create table in select

    concerning

    Pravin

  • Problems with the materialized view

    Hello

    I need help enforce data integrity using a materialized view. In my example, each system can consist of three types of components, and it is modeled using the supertype/subtype relationships. I'm trying to argue that, for a given system, a component cannot reside in more than one table of components. For example, given the system 1, if A component exists in the mobile_components table, it is impossible to insert into the table desktop_components for system 1. Rather than using triggers, I try to use views materialized with unique constraint to enforce this rule based on the example of "The trouble with triggers" article http://www.oracle.com/technetwork/issue-archive/2008/08-sep/o58asktom-101055.html of Tom Kyte. However, I can't seem to make it work because it gives me ORA-12054: cannot set the ON COMMIT refresh attribute.  I use UNION ALL and I know that can be difficult, but I can not understand what are the rules I'm breaking.  I have the necessary privileges.  Oracle 11g.  Can anyone help?

    Thank you

    Mark

    create table systems (
    sys_id number,
    sys_name varchar2(100),
    constraint sys_pk primary key (sys_id),
    constraint sys_uk unique (sys_name));
    
    insert into systems values (1,'System 1');
    insert into systems values (2,'System 2');
    
    
    

    create table mobile_components (
    mo_comp_id number,
    mo_comp_name varchar2(100),
    mo_comp_sys_id number,
    constraint mo_pk primary key (mo_comp_id),
    constraint mo_uk unique (mo_comp_name, mo_comp_sys_id),
    constraint mo_fk foreign key (mo_comp_sys_id) references systems (sys_id));
    
    insert into mobile_components values (1,'Component A',1);
    insert into mobile_components values (2,'Component A',2);
    
    
    

    create table desktop_components (
    de_comp_id number,
    de_comp_name varchar2(100),
    de_comp_sys_id number,
    constraint de_pk primary key (de_comp_id),
    constraint de_uk unique (de_comp_name, de_comp_sys_id),
    constraint de_fk foreign key (de_comp_sys_id) references systems (sys_id));
    
    insert into desktop_components values (1,'Component B',1);
    insert into desktop_components values (2,'Component B',2);
    
    
    

    create table internet_components (
    in_comp_id number,
    in_comp_name varchar2(100),
    in_comp_sys_id number,
    constraint in_pk primary key (in_comp_id),
    constraint in_uk unique (in_comp_name, in_comp_sys_id),
    constraint in_fk foreign key (in_comp_sys_id_ references systems (sys_id));
    
    insert into internet_components values (1,'Component C',1);
    insert into internet_components values (2,'Component C',2);
    
    
    

    create materialized view log on mobile_components with rowid;
    create materialized view log on desktop_components with rowid;
    create materialized view log on internet_components with rowid;
    
    
    

    create materialized view mv_components
    refresh fast on commit with rowid as
    select rowid as row_id, mo_comp_id as comp_id, mo_comp_name as comp_name
    from mobile_components
    union all
    select rowid, de_comp_id, de_comp_name
    from desktop_components
    union all
    select rowid, in_comp_id, in_comp_name
    from internet_components;
    
    alter table mv_components add constraint mv_comp_uk unique (comp_id, comp_name);
    
    
    

    You need a column marker to distinguish which questions you Union, that the data are:

    for example

    Create materialized view mv_components

    cool off quickly on commit with rowid as

    Select 'a' marker, rowid as row_id, mo_comp_id as identifiant_composant mo_comp_name as comp_name

    of mobile_components

    Union of all the

    Select 'b', rowid, de_comp_id, de_comp_name

    of desktop_components

    Union of all the

    Select 'c', rowid, in_comp_id, in_comp_name

    of internet_components;

  • Materialized view fast refresh option

    Dear all,

    I have a vision materilized which refreshes every 5 minutes and his works well, but one of the base tables has 300 fields and I need this view refresh only when 3 of the fields of 300 has evolved.

    If anyone can help me, I understand that

    The script of my VM is:

    CREATE MATERIALIZED VIEW SCHEMA1. INVM_TARJETADEBITO_SALDOS_VM

    N OCACHE

    LOGGING

    NOCOMPRESS

    NOPARALLEL

    BUILD IMMEDIATE

    REFRESH FAST START WITH SYSDATE NEXT SYSDATE + 5/1440

    WITH THE PRIMARY KEY

    AS

    SELECT CHAMP_1, CHAMP_2, FIELD_3, FIELD_4

    OF SCHEMA1. TABLE_1 has, SCHEMA1. TABLE_2 b

    WHERE a.PK_1 = b.PK_1;

    Best regards

    Diego Nuñez

    > but one of the base tables has 300 fields and I need from this point of view, refresh only when 3 of the fields of 300 has evolved.

    You cannot set this "restriction".  If a row is updated - know if 1 single byte in a column or 300 columns are updated - the line qualifies to be propagated to the MV.

    That you can set is * that * columns are replicated in the MV.

    For the journal of MV, you can also specify which columns are referenced as columns of filter (with the WITH clause).  It is usually of the columns that use the MV and/or is the joining columns for a MV that has a join.

    Hemant K Collette

  • the materialized view query

    Hello

    I had created a materialized view, it refreshes every 3 minutes. At the end of 3 minutes next time we are accessing the old records of materialized view should be deleted. Can someone help me with this query...
    create or replace materialized view deptd_mvu
         refresh fast on commit
         start with sysdate
         next sysdate + 3/(60*24)
         as select *
            from deptd;

    969052 wrote:
    No, my query shows all data are there is no error in my query? can u help me

    # It is not a mistake on your part of the implementation or Oracle. Error lies in understanding.

    Materialized view appeared in SELECT * FROM DEPT; So, it must take all the data that are available in the Dept table each time it is regenerated.

    What you intend to do is force the MView to choose the data "Modified" of table DEPT. Is not possible, unless you have some distinctive sign that the MView should be checked.

    For Eg :-(just an idea that I did not test this)

    Adding another column to identify records updated the: -.

    alter table dept add is_modified varchar2(1) default 'N';
    

    MView create instruction me altered as

    select *
      from dept
    where is_modified = 'Y';
    

    Write a trigger that sets the column IS_MODIFIED 'Y', each time that a record is inserted or updated. Don't worry about the deleted records (if this isn't a Soft Delete) as MView does not see records that are not present in the master table.

    You simply need to ensure that, whenever the MView is refreshed, the IS_MODIFIED the Department table must be set to 'n', so that it does not display a false positives.

  • Taking some time to refresh materialized view

    I'd like to understand why refresh of the materialized view takes more time than to run the sql code of the materialized view.
    For example, I have a test_mv of materialized view that is created as below; When I simply run the select statement I get the result in 34 seconds, while if I try to update help
    BEGIN
    DBMS_MVIEW.refresh ('wi_mv7_monthly','C',ATOMIC_REFRESH=>false);
    end;
    /
    It takes about 74 dry

    Creation of MV
    Oracle version: Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    create materialized view TEST_MV
    (
      COLUMN_NAME_1,
      OBJECT_NAME,
      COLUMN_ID,
      "SUM(C.DATA_LENGTH)"
    ) organization heap
    
    partition by list (COLUMN_ID) (
     PARTITION "first_10_col" VALUES
      (
        1, 2, 3, 4, 5, 6, 7, 8, 9, 10
      ),
       PARTITION "After_10_col" VALUES
      (
        11,12, 13, 14, 15, 16, 17, 18, 19, 20
      ),
       PARTITION "NONE" VALUES (DEFAULT)
      )
    BUILD IMMEDIATE USING INDEX REFRESH COMPLETE ON DEMAND USING DEFAULT LOCAL ROLLBACK SEGMENT USING ENFORCED CONSTRAINTS
    as 
    select  /*+ parallel(o,8) parallel(c,2) */
    C.COLUMN_NAME as COLUMN_NAME_1,O.OBJECT_NAME,C.COLUMN_ID,SUM(C.DATA_LENGTH) from ALL_OBJECTS O
    join ALL_tab_columns c on c.table_name=o.object_name
    group by 
    C.COLUMN_NAME,O.OBJECT_NAME,C.COLUMN_ID
    Published by: user627047 on Sep 6, 2012 06:56

    SQL select statement some readings and refresh the views but mview reads and writes, so it consumes more time.

    If you want to speed up the cooling you can use the Refresh method fast mview

  • DDL of Materialized view

    Hi all

    I want to check the script or the DDlL of Materialized view.
    whts the statement? Help, please.


    Thanks in advance.

    Only.ashish99 wrote:
    People here are only to acquire knowledge, I think. don't want spread.
    56 people checked this request, but do not want to answer because there seems to be little.

    but it's an important thing for a beginner, we could get.

    I understand the 56 people checked this query. But have you tried what I posted? If Yes, what was the error? If not or do not want to try why ask this question?
    Second thing, you can be newbie but does google or the document does not have you helped with what means ORA-00904 means.

    Let me try if I can make you understand or not.
    ORA-00904 means identifier valid, in other words, you used the object name is not valid or is not recognized by the current session of the Oracle.
    This means that the object do not exist or you don't have privilege on this object.

    Do

    desc dbms_metadata
    
    if above does not work
    grant execute on dbms_metadata to      --This should be done with sys login
    

    Concerning

  • ORA-12028: type of materialized view is not supported by the main site

    Hi guys!

    We face a problem these days about the materialized view.

    We have upgraded database version 9.2.0.7 directly to 10.2.0.5 (RHEL4 x 86) on the same host. Database uses the driver dg4odbc to connect with remote SQL Server 2012 through data binding called MIKSERI. Our developer team would like to have replicated SQL server table data side Oracle using the materialized view.

    They created Materialized view, but it is not at all to refresh the data. I tried to study a little bit, and whenever I try to change the view anyway I hit error:

    ORA-12028: view type is not supported by the master site materialized @ 'MIKSERI '.

    ORA-06512: at line 22

    I looked at the solutions proposed and discovered that it is maybe the compatible database parameter, so I changed from previous 9.2.0.0.0 to 10.2.0.1.0 but still no luck. Just to emphasize this database is of course different clone of production to a different database, with db name retained and other parameters, but on another host computer and listening port. I even try to change global name, but still no luck.

    Main problem is that refresh the work does not at all. To be more precise, we have created MV on the side of the Oracle and FULL Refresh should be done every 3 minutes. MV uses HS db link to the sql server database.

    During the creation of MV, we can see currently given to sql server, but the problem is that we cannot do MV to refresh every 3 minutes. When I try to change MV and put the refresh interval I get above error.

    Any kind of help would be greatly appreciated,

    Thank you

    I found the reason why my MV update jobs failed, job_queue_processes parameter was equal to 0. I change this setting and now works fine.

    Thank you for your time!

Maybe you are looking for