ORA-01555 when performing refresh of materialized views via DBMS_JOB

All,
With this project needing to be finished soon and an issue occuring on the local database, I am hopefuly one of you will have the answer or resolution so that I may complete this project soon....
Here is the setup..
10g database (remote)
9i database (local
DB Link from local to remote database
103 materialized views in local database that are refreshed by pulling data from dblink to remote database.
A PL/SQL procedure has been created which sets the v_failures variable = 0 and then performs a check to see if the current job has a failure and if so, inserts that value into the v_failures variable. When that reaches "1", then the procedure does nothing and closes out. If the failures are equal to "0" then it performs a DBMS_MVIEW.REFRESH procedure for each materialized view.
This worked the first time but its continually failing now with the ORA-01555 error (snapshot too old). From what I can tell, the dbms_job duration is 4 seconds and the Last_Exec is 2m 7s after it starts (8:30 PM). With that said, our DBAs working o nthe project have increased the Undo_Retention settings and assure us that shouldn't be the problem. Odd thing is, this never happened in the dev environment when we were developing/testing - only in the production environment once it got migrated.
I am looking for possible causes and possible solutions to the ORA-01555 error. A sample of the code in my procedure is below:
CREATE OR REPLACE PROCEDURE Ar_Mviews IS
V_FAILURES NUMBER := 0;
BEGIN
BEGIN
          SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
          IF V_FAILURES = 1 THEN NULL;
          ELSE
DBMS_MVIEW.REFRESH ('AR_BATCH_RECEIPTS_V', 'C');
          DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
END;
BEGIN
     SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
          IF V_FAILURES = 1 THEN NULL;
          ELSE
DBMS_MVIEW.REFRESH ('AR_BATCHES_ALL_V', 'C');
          DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
END;
END Ar_Mviews;
---------------------------------------------------------------------------------------------------------------

We are doing complete refreshes and doing it that way for consistency in the data presented. Because some materialized views are dependent upon data in other materialized views, we have them ordered in a procedure so that when one finishes, the next starts and they are also in a specific order as to ensure accurate data.
The condition for v_failures is done so that the job doesn't get, lets say, 90% finished and hit an error and start over again. We do the IF statement which results in NULL (do nothing) so that the job doesn't repeat itself over and over again. If one MV fails, we have to consider the job a failure and do nothing else because the one MV that failed may have been a dependency of another MV down the line. (i.e. MV7 calls MV3 and MV3 fails, so the whole job fails because MV7 can't be accurate without the most current data from MV3).
As well, this is being performed in off-business hours after backup to tape, etc. and prior to start of business so that no one is using the system when we run this job. That won't always be the case when we move to high availability with this system for varying time-zone end-users.
I hope I have answered your question and look forward to continued feedback.
Thanks!

Similar Messages

  • ORA-25175 when trying to create materialized view, organization index SOLV

    Hi,
    I'm trying to create a materialized view to compensate for non-normalized table.
    I have table anormal, and mv is to be on distinct agency, company in that table.
    Here goes:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Productio
    NLSRTL Version 10.2.0.3.0 - Production
    SQL> create table anormal (company varchar2(8) not null
      2                       ,dept varchar2(8) not null
      3                       ,agency varchar2(8) not null
      4                       ,constraint anormal_pk primary key (company,dept));
    Table created.
    SQL> insert into anormal values('c1', 1, 'Ajax');
    1 row created.
    SQL> insert into anormal values('c1', 2, 'Ajax');
    1 row created.
    SQL> insert into anormal values('c1', 3, 'Acme');
    1 row created.
    SQL> insert into anormal values('c2', 1, 'Acme');
    1 row created.
    SQL> insert into anormal values('c2', 2, 'Acme');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from anormal;
    COMPANY  DEPT     AGENCY
    c1       1        Ajax
    c1       2        Ajax
    c1       3        Acme
    c2       1        Acme
    c2       2        Acme
    SQL> create materialized view agency_comp_mv
      2  organization index --primary key (agency, company)
      3  build deferred
      4  refresh on demand
      5  as
      6  select distinct agency, company from anormal
      7  /
    select distinct agency, company from anormal
    ERROR at line 6:
    ORA-25175: no PRIMARY KEY constraint found
    SQL>The error tells me that there is no primary key, but is there any way to add such?
    - or is my problem rather that I cannot use DISTINCT with organization index?
    Regards
    Peter
    bump
    Message was edited by:
    Peter Gjelstrup
    <SOLVED>
    Message was edited by:
    Peter Gjelstrup

    Thanks William,
    I tried with ON PREBUILT TABLE, just to see what happens.
    Building on my OP:
    SQL> create table iot(agency varchar2(8) not null, company varchar2(8) not null
      2                  ,constraint iot_pk primary key (agency,company))
      3  organization index;
    Table created.
    SQL> insert into iot select distinct agency, company from anormal;
    4 rows created.
    SQL> commit;
    Commit complete.
    SQL> create materialized view iot on prebuilt table
      2  as
      3  select distinct agency, company from anormal;
    Materialized view created.
    SQL> select * from iot;
    AGENCY   COMPANY
    Acme     c1
    Acme     c2
    Ajax     c1
    SQL> insert into anormal values('c3', 2, 'Foo');
    insert into anormal values('c3', 2, 'Foo')
    1 row created
    SQL> select * from anormal;
    COMPANY  DEPT     AGENCY
    c1       1        Ajax
    c1       2        Ajax
    c1       3        Acme
    c2       1        Acme
    c2       2        Acme
    c3       2        Foo
    6 rows selected.
    SQL> select * from iot;
    AGENCY   COMPANY
    Acme     c1
    Acme     c2
    Ajax     c1
    3 rows selectedNow, try to refresh and MV
    SQL> alter materialized view iot refresh complete;
    Materialized view altered.
    SQL> select object_type, to_char(last_ddl_time, 'hh:mi:ss'), status
      2    from user_objects where object_name = 'IOT';
    OBJECT_TYPE         DDL_TIME STATUS
    TABLE               10:40:42 VALID
    MATERIALIZED VIEW   10:41:13 VALID
    SQL> select * from iot;
    AGENCY   COMPANY
    Acme     c1
    Acme     c2
    Ajax     c1Agency "Foo" is not in MV,
    Looks like that IOT select'ed from is indeed the MV:
    SQL> drop table iot;
    drop table iot
    ERROR at line 1:
    ORA-12083: must use DROP MATERIALIZED VIEW to drop "STIK"."IOT"
    SQL>So, seems that Maxim is right, it just can't be done. And it seems my options are:
    Create HEAP organized MV or
    Create and maintain IOT
    Regards
    Peter

  • Ora-13226 when performing spatial query on view

    Hi,
    in my database I have a view with spatial column. The view is based on UNION ALL select. When I try to run spatial query on the view, the database returns ora-13226 error. When I recreate the view to consist only one select (without UNION ALL) the spatial query return correct result. Could you pls help me how to do a spatial query on spatial view whose definition contains UNION ALL select?
    Thanks
    Andrew

    Hi,
    it's quite simple:
    create view test_view as
    select id, geometry from table_a
    union all
    select id, geometry from table_b;
    When I try for example:
    select *
    from test_view
    where sdo_relate(geometry, (select geometry from table_c where id=1316),'mask=anyinteract') = 'TRUE';
    it throws ora-13226 error.
    Interesting is that following query where the geometry is directly included runs well:
    select *
    from test_view
    where sdo_relate(geometry, MDSYS.SDO_GEOMETRY (....),'mask=anyinteract') = 'TRUE';
    also when I recreate the test_view as
    create view test_view as
    select id, geometry from table_a;
    then also the first query (with inner select) returns no error.
    It's a little bit strange isn't it?
    Andrew

  • Refresh a materialized view in parallel

    Hi,
    To improve the refresh performance for a materialized view, I set up it to be refreshed in parallel. The view can be refreshed successfully, however, I did not see the view is refreshed in parallel from session browser, can someone let me know if I miss any steps?
    1) In DB A (running 8 CPUs), set up the base table to be parallelized, the base table is called table1
    ALTER TABLE A.table1 PARALLEL ( DEGREE Default INSTANCES Default );
    2) In Database A, set up the materialized view log
    CREATE MATERIALIZED VIEW LOG
    ON table1 WITH primary key
    INCLUDING NEW VALUES;
    3) In Database B (in the same server with Database A), there is an existing table called table1, prebuilt with millions of records in the table. Due to the size of table1, I have to use prebuilt option
    Drop MATERIALIZED VIEW table1;
    CREATE MATERIALIZED VIEW table1 ON PREBUILT TABLE
    REFRESH FAST with primary key
    AS
    select /*+ PARALLEL(table1, 8) */ *
    from table1@A;
    4) in Database B, I executed this stored procedure -
    EXECUTE DBMS_MVIEW.REFRESH(LIST=>'table1',PARALLELISM=>8, METHOD=>'F');
    Thanks in advance!
    Liz

    I checked the execution plan when I executed the refresh stored procedure again, Does the plan indicates the parallel execution is working or not?
    SELECT STATEMENT REMOTE ALL_ROWSCost: 32,174 Bytes: 775,392 Cardinality: 1,182                                                   
    13 PX COORDINATOR                                              
    12 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10001 :Q1001                                        
         11 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1001                                   
         9 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1001Cost: 32,174 Bytes: 775,392 Cardinality: 1,182                               
              6 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1001                         
                   5 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1001                    
                        4 PX SEND ROUND-ROBIN PARALLEL_FROM_SERIAL SYS.:TQ10000 A               
                             3 VIEW APP_USR. Cost: 12,986 Bytes: 6,070,196 Cardinality: 275,918           
                                  2 HASH UNIQUE Cost: 12,986 Bytes: 9,105,294 Cardinality: 275,918      
                                       1 TABLE ACCESS FULL TABLE A.MLOG$_TABLE1 A Cost: 10,518 Bytes: 9,105,294 Cardinality: 275,918
         8 PARTITION RANGE ITERATOR PARALLEL_COMBINED_WITH_PARENT :Q1001Cost: 0 Cardinality: 1                          
         7 INDEX RANGE SCAN INDEX (UNIQUE) PARALLEL_COMBINED_WITH_PARENT A.PK_TABLE1 :Q1001Cost: 0 Cardinality: 1                     
    10 TABLE ACCESS BY LOCAL INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT A.TABLE1 :Q1001Cost: 0 Bytes: 634 Cardinality: 1

  • Fast Refresh Nested Materialized View problem in ORACLE 9i 9.2.0.7

    Hello
    My problem is in creating fast refresh nested materialized view in oracle 9i
    In below is an example of my problem
    ( I need to say when I run this example in Oracle 11g all things is OK )
    create table ali.alitest1(id number primary key,n1 number,n2 number);
    create table ali.alitest2(id number primary key,n3 number);
    CREATE MATERIALIZED VIEW LOG ON ali.alitest1 WITH ROWID,PRIMARY KEY ,SEQUENCE
    (n1,n2)
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW LOG ON ali.alitest2 WITH ROWID,PRIMARY KEY ,SEQUENCE
    (n3)
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW ali.alitest1_mv
    REFRESH WITH PRIMARY KEY FAST
    AS
    select id,n1 from ali.alitest1;
    CREATE MATERIALIZED VIEW LOG ON ali.alitest1_mv WITH ROWID,PRIMARY KEY ,SEQUENCE
    (n1)
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW ali.alitest2_mv
    REFRESH WITH PRIMARY KEY FAST
    AS
    select t1.id,t1.n1,t2.n3,t1.rowid "t1_rowid",t2.rowid "t2_rowid" from ali.alitest1_mv t1,ali.alitest2 t2 where t1.id=t2.id;
    SQL Error: ORA-12053: this is not a valid nested materialized view
    12053. 00000 - "this is not a valid nested materialized view"
    *Cause:    The list of objects in the FROM clause of the definition of this
    materialized view had some dependencies upon each other.
    *Action:   Refer to the documentation to see which types of nesting are valid.
    do you know what is problem ?
    thanks

    Take look for this link :
    http://rwijk.blogspot.com/2009/08/fast-refreshable-materialized-view.html

  • Erro perforing Fast Refresh of Materialized View.

    Hi Experts,
    We are facing serious problem while refreshing materialized views using fast refresh option in ORACLE..
    For the very first time we are performing Complete refresh of data from DB1 to DB2 for few tables.Ongoing we are performing Fast Refresh.
    Sometimes the fast refresh works fine without any error and sometimes it fails with the below error.
    ERROR at line 1:
    ORA-32320: REFRESH FAST of "CIR"."C_BO_COMM" unsupported after cointainer table
    PMOPs
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 803
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 860
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 841
    ORA-06512: at line 1we came to know the folowing.
    // *Cause:
      A Partition Maintenance Operation (PMOP) has been performed on the materialized view,
      and no materialized view supportsfast refersh after container table PMOPs.
    // *Action:
                   Use REFRESH COMPLETE.
         Note: 
                   you can determine why your materialized view does not support fast refresh after PMOPs using
                   the DBMS_MVIEW.EXPLAIN_MVIEW() API.Please let u know what action to be taken to avoid this.
    Please note that this error is not repeated always. Some times REFRESH FAST is happening and some times it is throwing error.
    Appreicate your earliest reply.
    Thank you.
    Edited by: User71408 on Sep 4, 2008 11:40 PM
    Edited by: User71408 on Sep 4, 2008 11:43 PM
    Edited by: User71408 on Sep 5, 2008 12:38 AM

    9i doesn't support fast refresh after truncate. Read the metalink note 275325.1
    You should be sure no truncate has been executed, or use complete refresh.
    Nicolas.

  • Refresh of materialized views

    Hi there,
    i've got a question to the refreshment of materialized views: when updating or inserting / deleting data of some specific tables, my materialized view should be updated.
    First of all, i though to make that happen by using triggers on the specific table and the DBMS_MVIEW.REFRESH() mechanism. But as i have read pretty often, it isn't recommended doing that with triggers.
    But how can I get what I want :-)
    Thank a lot for your answers,
    Martin
    Edited by: 949697 on Mar 4, 2013 1:11 AM

    Thanks for your answers,
    the case with FAST REFRESH doesn't work. Our materialized are very complex and are using e.g subselect-statments, analytic functions,UNION, Order, Group by.... According to the documentation, we can't use the FAST REFRESH.
    Using the REFRESH ON COMMIT could be possible. Having a look at the documentation, there is one interesting sentence: A REFRESH ON COMMIT materialized view is refreshed automatically when a transaction that does DML to one of the materialized view's detail tables commits
    What are the materialized view's detail tables? Are that all tables in the FROM-Part of the query?
    Martin

  • How can I manually refresh a Materialized View

    Hi,
    There's a materialized view created in 2006 as under:
    CREATE MATERIALIZED VIEW "schema"."mv_name"
    USING INDEX
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE AS SELECT * FROM "table_name@dblink;
    The problem is that the last refresh was done in Aug. I want to manually refresh this materialized view right now as there is a procedure based on this MV and its not showing the right data as the above materialized view has not been refreshed, so the data for this month is not showing.
    Please let me know how I can refresh that MV right now.
    Also do I need to change the refresh option. How can I change it so that the MV refreshes itself every second.
    Thanks

    Also do I need to change the refresh option. How can
    I change it so that the MV refreshes itself every
    second. Every second? Why do you want to do that?? Perhaps waht you really want is refresh the MV on commit.

  • Materialized Views or DBMS_JOBS?

    Hellow
    I have a situation where there are 2 database servers "db1" and
    "db2". Both the servers have a common schema containing common tables.
    Some tables in db1 is getting updated repeatedly in every 3sec. I need
    to synchronise this tables with the corresponding replica tables in
    db2 after every 4sec.
    I cannot opt for trigger because in every 3 sec entire data in the
    able is flushed out and new data is populated....so i need to wait for 3
    sec and then do the same thing for the replica table in db2 by copying data
    from db1 to db2...
    what option will be better Materialized View or DBMS_JOB...I mean i
    thought of writing a plsql script which will update the table in db2
    after every 5sec..by associating this script with DBMS_JOB
    performance wise which will be more better?
    Regards
    sam

    Actually it is getting populated by new coordinates which depict the latest location of a moving object. this data is constantly getting updated (deleted and re-populated)
    this is being done in db1 and we are asked to replicate the tables and populate the latest data from the tables in db1 to corresponding tables in db2.
    we need to perform the same operation in db2 in every 5sec...thats the main issue
    we will be accessing these coordinates and display them on a map, later...
    performance wise which option will be good
    1. Materialized Views
    2. DBMS_JOBS (relating to a pl/sql code)
    also is there any much difference in performance from a normal view when compared to materialized views?
    please suggest
    Regards
    Sam

  • A bug when refreshing a materialized view?

    I am getting "ORA-00603: ORACLE server session terminated by fatal error" upon refresh of a materialized view. I've put together a test case to demonstrate the problem. Is it a bug?
    SQL*Plus: Release 10.1.0.3.0 - Production on Fri Jul 29 13:43:45 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production
    [email protected]> create table t (
      2  id int primary key,
      3  t_name varchar2(10),
      4  t_date date
      5  );
    Table created.
    [email protected]> create materialized view log on t
      2    with rowid (t_name, id, t_date) including new values;
    Materialized view log created.
    [email protected]> create materialized view t_mv
      2   build immediate
      3   refresh fast
      4   on commit
      5  as
      6   select t_name, max(id) id, max(t_date) t_date, count(*)
      7     from t
      8    GROUP BY t_name;
    Materialized view created.
    [email protected]> create materialized view log on t_mv
      2    with rowid (id) including new values;
    Materialized view log created.
    [email protected]> create table v (
      2  id int primary key,
      3  t_id int references t(id) on delete cascade,
      4  v_name varchar2(10)
      5  );
    Table created.
    [email protected]> create materialized view log on v
      2    with rowid (v_name, t_id) including new values;
    Materialized view log created.
    [email protected]> create materialized view v_mv
      2   build immediate
      3   refresh fast
      4   on commit
      5  as
      6  select v.rowid rowid1, t_mv.rowid rowid2, v.v_name, v.t_id
      7  from v, t_mv
      8  where v.t_id = t_mv.id;
    Materialized view created.
    [email protected]> alter table v_mv
      2  add constraint v_mv_uk1 unique
      3  (
      4  v_name
      5  )
      6   enable
      7  ;
    Table altered.
    [email protected]> insert into t (id, t_name, t_date) values (1, 'A', sysdate);
    1 row created.
    [email protected]> insert into t (id, t_name, t_date) values (2, 'B', sysdate);
    1 row created.
    [email protected]> insert into t (id, t_name, t_date) values (3, 'A', sysdate);
    1 row created.
    [email protected]> insert into t (id, t_name, t_date) values (4, 'A', sysdate);
    1 row created.
    [email protected]> insert into t (id, t_name, t_date) values (5, 'B', sysdate);
    1 row created.
    [email protected]> insert into v (id, t_id, v_name) values (1, 1, 'V_A_1');
    1 row created.
    [email protected]> insert into v (id, t_id, v_name) values (2, 2, 'V_B_1');
    1 row created.
    [email protected]> insert into v (id, t_id, v_name) values (3, 3, 'V_A_2');
    1 row created.
    [email protected]> insert into v (id, t_id, v_name) values (4, 4, 'V_A_3');
    1 row created.
    [email protected]> insert into v (id, t_id, v_name) values (5, 5, 'V_B_2');
    1 row created.
    [email protected]> commit;
    Commit complete.
    [email protected]> insert into t (id, t_name, t_date) values (6, 'A', sysdate);
    1 row created.
    [email protected]> insert into v (id, t_id, v_name) values (6, 6, 'V_B_2');
    1 row created.
    [email protected]> commit;
    commit
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-00001: unique constraint (FESA.V_MV_UK1) violated
    [email protected]> -- ORA-12008 is fine here: that's what was expected
    [email protected]> delete from t where id = 5;
    1 row deleted.
    [email protected]> commit;
    ERROR:
    ORA-03114: not connected to ORACLE
    commit
    ERROR at line 1:
    ORA-00603: ORACLE server session terminated by fatal errorWhy ORA-00603?
    Best regards,
    Maciej

    It may be a bug, or it may be a result of the dependencies between the materialized views. I don't have a 9.2.0.6 instance that I'm willing to trash to test this, but this is what I get on 9.2.0.1.
    If it is a bug they at least changed the behaviour of the bug in 9.2.0.6.
    I ran your script up to the first commit then did:
    SQL> SELECT * FROM t;
            ID T_NAME     T_DATE
             1 A          29-JUL-05
             2 B          29-JUL-05
             3 A          29-JUL-05
             4 A          29-JUL-05
             5 B          29-JUL-05
    SQL> SELECT * FROM t_mv;
    T_NAME             ID T_DATE      COUNT(*)
    A                   4 29-JUL-05          3
    B                   5 29-JUL-05          2
    SQL> SELECT * FROM v;
            ID       T_ID V_NAME
             1          1 V_A_1
             2          2 V_B_1
             3          3 V_A_2
             4          4 V_A_3
             5          5 V_B_2
    SQL> SELECT * FROM v_mv;
    no rows selectedHUH?? But:
    SQL> SELECT v.rowid rowid1, t_mv.rowid rowid2, v.v_name, v.t_id
      2  FROM v, t_mv
      3  WHERE v.t_id = t_mv.id;
    ROWID1             ROWID2             V_NAME           T_ID
    AAAH4QAAIAAAAl1AAD AAAH4MAAIAAAAlFAAA V_A_3               4
    AAAH4QAAIAAAAl1AAE AAAH4MAAIAAAAlFAAB V_B_2               5So, I tried:
    SQL> EXEC DBMS_MVIEW.REFRESH('V_MV');
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM v_mv;
    no rows selectedNow, this is confusing, so:
    SQL> EXEC DBMS_MVIEW.REFRESH('V_MV', 'COMPLETE');
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM v_mv;
    ROWID1             ROWID2             V_NAME           T_ID
    AAAH4dAAIAAAAl1AAD AAAH4ZAAIAAAAlFAAA V_A_3               4
    AAAH4dAAIAAAAl1AAE AAAH4ZAAIAAAAlFAAB V_B_2               5So at least I've got something in the MV. Now, to continue your test:
    SQL> insert into t (id, t_name, t_date) values (6, 'A', sysdate);
    1 row created.
    SQL> insert into v (id, t_id, v_name) values (6, 6, 'V_B_2');
    1 row created.
    SQL> COMMIT;
    Commit complete.I also expected the error but no joy, and look at this:
    SQL> SELECT * FROM v_mv;
    ROWID1             ROWID2             V_NAME           T_ID
    AAAH4dAAIAAAAl1AAE AAAH4ZAAIAAAAlFAAB V_B_2               5Forcing the refresh on v_mv gets:
    SQL> EXEC DBMS_MVIEW.REFRESH('V_MV', 'COMPLETE');
    BEGIN DBMS_MVIEW.REFRESH('V_MV', 'COMPLETE'); END;
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-00001: unique constraint (OPS$ORACLE.V_MV_UK1) violatedVery strange! It gets better:
    SQL> DELETE FROM t WHERE id = 5;
    1 row deleted.
    SQL> commit;
    Commit complete.
    SQL> EXEC DBMS_MVIEW.REFRESH('V_MV', 'COMPLETE');
    PL/SQL procedure successfully completed.
    SQL> select * from v_mv;
    ROWID1             ROWID2             V_NAME           T_ID
    AAAH4dAAIAAAAl1AAF AAAH4ZAAIAAAAlFAAA V_B_2               6 But:
    SQL> SELECT * FROM t_mv;
    T_NAME             ID T_DATE      COUNT(*)
    A                   6 29-JUL-05          4
    B                   5 29-JUL-05          2
    SQL> SELECT * FROM t;
            ID T_NAME     T_DATE
             1 A          29-JUL-05
             2 B          29-JUL-05
             3 A          29-JUL-05
             4 A          29-JUL-05
             6 A          29-JUL-05Obvioulsy, something is not fast refreshing. So lets force it:
    SQL> EXEC DBMS_MVIEW.Refresh('T_MV', 'COMPLETE');
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t_mv;
    T_NAME             ID T_DATE      COUNT(*)
    A                   6 29-JUL-05          4
    B                   2 29-JUL-05          1
    SQL> SELECT * FROM v_mv;
    ROWID1             ROWID2             V_NAME           T_ID
    AAAH4dAAIAAAAl1AAB AAAH4qAAIAAAAlEAAB V_B_1               2
    AAAH4dAAIAAAAl1AAF AAAH4qAAIAAAAlEAAA V_B_2               6Which looks right to me.
    Then, I blew everything away and did it allagain up to an including the inserts into t, then I inserted into v and commited. Now, both MV's were correct, so I did:
    SQL> insert into t (id, t_name, t_date) values (6, 'A', sysdate);
    1 row created.
    SQL> insert into v (id, t_id, v_name) values (6, 6, 'V_B_2');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> SELECT * FROM t_mv;
    T_NAME             ID T_DATE      COUNT(*)
    A                   6 29-JUL-05          4
    B                   5 29-JUL-05          2Still strange, so blow it all away again insert into t commit, insert into v commit, then:
    SQL> insert into t (id, t_name, t_date) values (6, 'A', sysdate);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> insert into v (id, t_id, v_name) values (6, 6, 'V_B_2');
    1 row created.
    SQL> commit;
    commit
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-00001: unique constraint (OPS$ORACLE.V_MV_UK1) violatedAt least now it sees the error at commit time for v so lets try the delete:
    SQL> delete from t where id = 5;
    1 row deleted.
    SQL> commit;
    Commit complete.
    SQL> SELECT * FROM t_mv;
    T_NAME             ID T_DATE      COUNT(*)
    A                   6 29-JUL-05          4
    B                   5 29-JUL-05          2
    SQL> SELECT * FROM t;
            ID T_NAME     T_DATE
             1 A          29-JUL-05
             2 B          29-JUL-05
             3 A          29-JUL-05
             4 A          29-JUL-05
             6 A          29-JUL-05Still not actually refreshing somehow.
    I may play with this some more, it seems truly strange to me.
    John

  • Issue with complete refresh on materialized view when using rownum

    Hi all,
    I had an issue with rownum when using complete refresh
    I am using rownum when creating materialized view and it is generation correctly.But the issue was when i am refreshing the same ,rownum was not getting sorted in ascending order.
    anyone had come across this scenario

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

  • To increase performance of refresh of Materialized View

    Dear Members,
    I have a set of 231 Materialized Views on a remote database from which I am refreshing data through materialized views. I.e. I have 231 materialized views which are directly copying data from the source views into our internal databases. (basically select column1, column2.... from viewname@dblinkname) There are no where clauses in any of the tables. The refreshes take around 4 hours to run. They either get fast refreshed or complete refresh. It's an on-demand type of refresh.
    Could anyone give me suggestions of improving the performance of these refreshes? I would appreciate some guidance in this case.
    Kind Regards,
    Suhas

    Hi Suhas,
    If you are asking about Coherence database integration, you could start here ...
    http://coherence.oracle.com/display/COH34UG/Read-Through,+Write-Through,+Write-Behind+and+Refresh-Ahead+Caching
    Thanks

  • BEST WAY TO REFRESH A MATERIALIZED VIEW

    Hi, I have a Materialized View that was created after two Base Tables, Table A is a Dynamic Table, this means that it have Insert's, update's and delete's, and a Table B that is a Fixed Table, this means that this table do not change over time (it's a Date's Table). The size of the Table related to the Materialized View is to big (120 millions rows) so the refresh has to be very efficient in order to not affect the Data Base performance.
    I was thinking on a Fast Refresh mode but It would not work because the log created on the B table is not usefull, the thing is that I created the two materialized view log's (Tables A and B) and when I execute the dbms_mview.refresh(list =>'MV', method => 'F')+ sentence I got the error
    cannot use rowid column from materialized view log on "Table B" ... remember that this table don't change over time ...
    I need to mantain the Materialized view up to date, but do not know how ... Please Help !!!!!

    The Materialized View name is test_sitedate2
    The Table B name is GCO01.FV_DATES .... is a Fixed Table ... do not change over time ...
    The Code of the MV is
    CREATE MATERIALIZED VIEW TEST_SITEDATE2
    REFRESH FORCE ON DEMAND
    AS
    SELECT site_id, date_stamp
    FROM gco01.fv_site, gco01.fv_dates
    where fv_dates.date_stamp >= fv_site.start_date
    and fv_dates.date_stamp >= to_date('01/03/2010', 'dd/mm/yyyy')
    and fv_dates.date_stamp < to_date('01/04/2010', 'dd/mm/yyyy');
    Each table gco01.fv_site and gco01.fv_dates have it's materiallized view log created
    The error is ....
    SQL> execute dbms_mview.refresh(list =>'test_sitedate2', method => 'F');
    begin dbms_mview.refresh(list =>'test_sitedate2', method => 'F'); end;
    ORA-12032: cannot use rowid column from materialized view log on "GCO01"."FV_DATES"
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2254
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2460
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2429
    ORA-06512: at line 1
    Thank's

  • Fast Refresh in Materialized Views Partitioned

    Hi all.. I've a little problem... let's go into it:
    I have two tables:
    A dimension table , named D1
    A partitioned fact table, named F1
    I create two materialized views log in each of 2 tables.
    Ok.. Now, I created a Materialized View Partitioned, name MV_F1D1, with incremental refresh for it...
    I can create the Materialized View Partitioned with fast refresh, no problem here...
    First time Oracle make a Complete refresh, everything ok.. Then I make a
         BEGIN
              DBMS_SNAPSHOT.REFRESH('MV_F1D1','F');
         END;
    And everything goes well...
    But.. In my fact tables, I load the data with a temporary table, named F1_NP (Fact table no partitionated)
    with the data of the current month. Every week I do this:
    1) Load the data in F1_NP
    2) If the LAST_PARTITION_MM_YYYY not exists in F1, I add the partition to F1...
    3) ALTER TABLE F1 EXCHANGE PARTITION LAST_PARTITION_MM_YYYY WITH TABLE F1_NP
    And, this is the problem....
    After that process, the Log table of F1 is empty..
    When i'm trying to fast refresh the mv_F1D1, I got an error
         ORA-12097 changes in the master tables during refresh, try refresh:
    THis occurs when only I truncate a partition
    in the fact table too.
    Ok.. My only solution here is to make a complete refresh.. But I have only a new partition. I expected that with the PCT, Oracle let me
    do it a fast refresh.      
    I'm looking for a solution in the web, and I installed the utlxmnv.sql:
    1) Before add a partition in F1
    truncate table mv_capabilities_table;
    exec DBMS_MVIEW.EXPLAIN_MVIEW ( 'MV_F1D1' );
    select * from mv_capabilities_table;
    PCT Y
    REFRESH_COMPLETE Y
    REFRESH_FAST Y
    REWRITE Y
    PCT_TABLE Y F1
    PCT_TABLE N D1 2068 Relation is not partitioned.
    REFRESH_FAST_AFTER_INSERT Y
    REFRESH_FAST_AFTER_ONETAB_DML Y
    REFRESH_FAST_AFTER_ANY_DML Y
    REFRESH_FAST_PCT Y
    REWRITE_FULL_TEXT_MATCH Y
    REWRITE_PARTIAL_TEXT_MATCH Y
    REWRITE_GENERAL Y
    REWRITE_PCT Y
    PCT_TABLE_REWRITE Y F1
    PCT_TABLE_REWRITE N D1 2068 Relation is not partitioned.
    2) After truncate a partition in F1
    truncate table mv_capabilities_table;
    exec DBMS_MVIEW.EXPLAIN_MVIEW ( 'MV_F1D1');
    select * from mv_capabilities_table;
    PCT Y
    REFRESH_COMPLETE Y
    REFRESH_FAST Y
    REWRITE Y
    PCT_TABLE Y F1
    PCT_TABLE N D1 2068 Relation is not partitioned.
    REFRESH_FAST_AFTER_INSERT N F1 2077 Mv log is newer than last full refresh
    REFRESH_FAST_AFTER_INSERT N F1 2077 Mv log is newer than last full refresh
    REFRESH_FAST_AFTER_ONETAB_DML N 2146
    REFRESH_FAST_AFTER_ANY_DML N F1 2076
    REFRESH_FAST_AFTER_ANY_DML N 2161
    REFRESH_FAST_PCT Y
    REWRITE_FULL_TEXT_MATCH Y
    REWRITE_PARTIAL_TEXT_MATCH Y
    REWRITE_GENERAL Y
    REWRITE_PCT Y
    PCT_TABLE_REWRITE Y F1
    PCT_TABLE_REWRITE N D1 2068 Relation is not partitioned.
    BEGIN
              DBMS_SNAPSHOT.REFRESH('MV_F1D1','F');
    END;
    ORA-32313: REFRESH FAST of "MV_F1D1" unsupported after PMOPs
    any ideas? Can I fast refresh a MV partitioned (composed with a Table Dimension and Fact table)
    with PCT when I add data in the Dimension Table/add a partition in a Fact Table Partitioned?

    Look at ATOMIC_REFRESH option, if you set this to FALSE you may see performance gain as it'll use DIRECT PATH and TRUNCATE. Data will be unavailable while being refreshed though.
    Cheers
    Si

  • Fast refresh of materialized view

    Hi All,
    This is my first posting on this forum, so I hope I don't step on anyone's toes as I wade into a problem that I am experiencing.
    I have a number of either join-only or single table aggregate materialized views that I have experienced problems with. All the views are setup for FAST REFRESH ON DEMAND but I'm hitting an error if I execute a COMPLETE refresh of the view when I've done an ALTER SESSION ENABLE PARALLEL DML. The error I get is:
    ERROR at line 1:
    ORA-30439: refresh of 'DTKTGT.CTNS_PER_HR_VOL_AGG_MV' failed because of ORA-32320: REFRESH FAST of "DTKTGT"."CTNS_PER_HR_VOL_AGG_MV" unsupported after cointainer table PMOPs
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 814
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 872
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 852
    ORA-06512: at "DTKTGT.MV_REFRESH", line 21
    ORA-06512: at line 2
    Any help anyone could provide would be greatly appreciated as every now and then, a COMPLETE refresh is unavoidable and using the ENABLE PARALLEL DML makes the refresh run a lot faster than without the ALTER SESSION.
    Gary

    This forum only is for questions relating to the use of OLAP Option. I would post your question on the database forum.
    Keith Laker
    Oracle Data Warehouse Product Management
    OLAP Blog: http://oracleOLAP.blogspot.com/
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    DM Blog: http://oracledmt.blogspot.com/
    OWB Blog : http://blogs.oracle.com/warehousebuilder/
    OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

Maybe you are looking for