Result of materialized views

Hi,
I have created a materialized view, making a complete refresh ervery day at 1am.
It's possible that a query on this mview at refresh time will be empty will the query execute before and after the refresh wont be empty.
(The refresh will take about 60 Minutes to complete.)
Thanks.
regards,
Rainers

When you do a complete refresh a materialized view, Oracle deletes the old data and inserts the new data in a single transaction. Queries will never see the materialized view as empty-- the will see the old data until the refresh finishes, at which point they will see the new data.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • Materialized views - query rewrite -- optional joins & dimensions

    Hi,
    I've implemented a number of materialized views that are accessible via query rewrite.
    Most of these views make use of duplicate tables (DD_TIME table is joined via purchase, load, process, ... date columns)
    I've also created a dimension to make Oracle aware of the time relation (month is child of year...)
    The issue:
    --> If I create the mat. view with inner joins, query rewrite works with the dimensions, but I need to provide ALL joined tables in the query
    --> If I create the mat. view with outer joins, query rewrite works even with 1 joined table, but the dimension seems to be ignored
    How can I create 'optional' joins in the Mat. View while making use of dimensions for rollup?
    (the limitations on materialized view delta joins mentioned on [oracle docs|http://docs.oracle.com/cd/B28359_01/server.111/b28313/qradv.htm#autoId16] kinda has me worried)
    Example Mat. View:
    CREATE MATERIALIZED VIEW DA_REPOSITORY_MERCHANT_MM
    ... ENABLE QUERY REWRITE
    AS SELECT
    DDFPC.YEAR_NO,
    DDFPC.YEAR_MONTH,
    DDPUR.YEAR_NO,
    DDPUR.YEAR_MONTH,
    SUM( DF.TRANSACTION_AMOUNT )
    FROM DF_REP DF,
    DD_TIME DDFPC,
    DD_TIME DDPUR
    WHERE DF.FPC_DTE = DDFPC.DAY_DATE(+)
    AND DF.PUR_DTE = DDPUR.DAY_DATE(+)
    GROUP BY
    DDFPC.YEAR_NO,
    DDFPC.YEAR_MONTH,
    DDPUR.YEAR_NO,
    DDPUR.YEAR_MONTH
    Example query launched:
    SELECT
    DDFPC.YEAR_NO,
    SUM( DF.TRANSACTION_AMOUNT )
    FROM DF_REP DF,
    DD_TIME DDFPC
    WHERE DF.FPC_DTE = DDFPC.DAY_DATE
    GROUP BY
    DDFPC.YEAR_NO

    The problem was resolved by setting foreign keys in the fact table and making them not nullable + using inner joins.
    --> this informs oracle there can be no difference between a query without the dimensions and a query with the dimensions.
    As a result, the materialized view can contain 1 fact linked to 2 dimension tables, but the query rewrite will work for queries on the 1 fact joined with only 1 dimension

  • Question on materialized view unregistered on master site

    Hi
    not sure how it is known, on master site, about the existence of an materialized view on another site referring some table of a master site. it seems registering is not necessary.
    on master site orcl1 : I have a table A, and a materialized view log defined on table A.
    on another site orcl2 : have a db link to orcl1 and a fast refreshable materialized view SCOTT.A_MVW (create materialized view A_MVW refresh fast as select * from A@orcl1)
    on orcl1 I perform : exec DBMS_MVIEW.UNREGISTER_MVIEW (mviewowner => 'SCOTT' ,mviewname => 'A_MVW' ,mviewsite => 'ORCL2');
    as a result the materialized view seems to be successfully unregistered (as it doesn't appear anymore in : select * from DBA_REGISTERED_MVIEWS; )
    But, to my surprise, I can still perform fast refreshes on A_MVW, which also remove lines from the materialized view log . so how is site orcl1 still aware about the existence of the materialized view ?
    it seems that, registered or not at master site, a materialized view behaves the same...or it doesn't ? where is it stored , on master site, information about materialized views (especially those fast refreshable) that reffer local tables ?
    Thank you

    The view allows the Administrator at the Master (Source) site to see information about MVs in remote databases that are querying his/her database.
    A database in Singapore may be administered by DBA "Hemant" . This database may have built (with appropriate permissions !!!) an MV that queries table(s) in a database in London managed by "Alex". Alex can query DBA_REGISTERED_MVIEWS in his (London) database to see that a remote MV is referencing tables locally.
    Why would "Alex" UNREGISTER the MV ? There's no real need to. Unless the information needs to be "hidden" from, say, an Outsource DBA who will be taking "Alex"'s place ! (just kidding !)
    Hemant K Chitale

  • Materialized views used by answers

    Hi,
    I had create some materialized views for some graphs created on answers of Analytics. The problem i have is that the graphs still take much time to show the results, the materialized views has summarized measures from they original table which is of 33 millions rows to 2000 rows.
    Is there any option do i have to check on the Administration of ORACLE Business Intelligence for the materialized views being take by the queries?
    thanks a lot

    Tables were not created and imported into the physical Layer
    - What was imported into the physical layer if not tables?
    Do i have to add the materialized views in the physical Layer?
    - If query rewrite is turned on then the materialized views don't have to be. Oracle can rewrite sql in the backgrounf
    I haven't eneabled the QUERY REWRITE, so maybe with this can used it.
    - Worth a shot
    Where do i have to check the statistics? in OEM or Settings-Manage Sessions ?
    - You can use OEM to analyze tables and materialized views (and their indexes)
    - Speaking of indexes - Are the indexes being used or is table access done with full table scans
    - Beach

  • Create Materialized View based on Results from LDAP Query

    Hi -- I'm trying to create a materialized view based on results from an LDAP query. Unfortunately, it looks like a materialized view can't be created based on a stored procedure, which is where the LDAP results are obtained (using nested loops).
    Does anyone have any idea how to do this without first kicking off a stored procedure that populates a temp table which would be used to create the materialized view? I'm trying to minimize the steps that the DBA's will need to go through when refreshing this new view.
    Thanks,
    ~Christine

    Can you give us more details about the stored procedure you're calling. It will help to know what parameters are involved and what data types they are.
    Off the top of my head though it looks like, at the very least, you would need a stored function that calls the stored procedure. I don't think there is any way to call stored procedures from CREATE ... commands. If you're going to create a stored function anyway ... well, you might as well just create a procedure that inserts values into a regular table instead of fussing with functions and materialized views. You'll probably want to schedule your new procedure to run periodically since it sounds like you'll need the values refreshed from time to time.

  • The data of my materialized view....in the while

    Hello
    We have problems with materialized views
    We have one wich re-build each a short period of time
    ¿Can i avoid the data to dissapear in the time process of refresh?
    Is so annoing to our clients to see that "from time to time" the data just dissapear for one period of time -the time while the materialized view is refreshing-
    Thank you in advance
    Bruno. Madrid. Spain

    > Is so annoing to our clients to see that "from time to time" the data just dissapear for
    one period of time -the time while the materialized view is refreshing-
    Have a similar problem. And dealing with large data volumes that makes the DELETE of the MV a very undesirable feature. Not as much a the resource footprint required, but the time it takes to do this - and the very tight processing windows that exist.
    The solution is a self-rolled and very likely not ideal for most - but it works well enough for us in production.
    No MV. Create a partition table. Create a staging table. Do a manual "full refresh" of the staging table (TRUNCATE and direct path INSERT). Follow this by a partition exchange with the partition table (no validation and including indexes). The result is that the data is replaced in the partitioned table within a second - no long running and expensive DELETE. End-users not effected by having a truncate pulling the data from beneath their reports.

  • Select query in materialized view with two dblinks

    Hi All,
    We have oracle 10g On windows.
    We are trying to create materialized view. Scenario is we have base table on other database and we are creating mview on different database.
    Basa database have two schema's and i am selecting records from that two schema's using two private db links.
    But when i am tryin gto create mview its not getting created. After 15 hrs. its still showing creation command and not finished.
    Query is :-
    Is it good practice to have two db links in select query of materialized view.

    Billy  Verreynne  wrote:
    Chanchal Wankhade wrote:
    Is it good practice to have two db links in select query of materialized view.Same db link being used twice, or two different db links?
    If the former, you ideally want the local Oracle db to send the join to the remote database, and for the remote database to drive the join between those 2 tables. There is a hint (<i>driving_site</i>) that can be used - or the join query can be defined on the remote database as a view, and the local materialised view can then use that remote view.
    If you have 2 different db links and joining across these - usually a bad idea to perform distributed database joins. There are lots of limitations as to how the tables can be joined. Worse case, full table scans of both remote tables, pulling all the rows from the 2 remote database tables to the local database, and joining these on the local database.
    I have seen some severe performance issues in the past as a result of distributed joins. I'll rather use 2 materialised views for pulling both distributed tables's data locally, and then do the join on local data (using indexes, partition pruning, etc)Hi Billy,
    My scenario is i have two database database A and database B. Database A is having two schema's SCOTT AND HR. SCOTT schema have select privileges on HR schema.
    DB LINK is between Database B to Database A. name is db.link.B.A.oracle.com.
    What if i priovide while creating materialized view, the schema name before the table name in database B for this particuler table so it will pick up the table from that schema using same DB LINK(db.link.B.A.oracle.com.) that i am using to fetch records from SCOTT schema.
    Above schnario is like two base schema's and one db link using two schema.

  • Leave a distinct value in a materialized view on two tables

    Hi and thank you for reading,
    I have the following problem. I am creating a materialized view out of two tables, with "where a.id = b.id".
    The resulting materialized view list several values twice. For example, one customer name has several contact details and thus the customer name is listed several times. Now I would like to join each customer name with just ONE contact detail, how can I do that? (Even if I would loose some information while doing this).
    Thanks
    Evgeny

    Hi,
    You can do this
    SELECT   deptno, empno, ename, job, mgr, hiredate, sal, comm
        FROM emp_test
    ORDER BY deptno;
        DEPTNO      EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM
            10       7782 CLARK      MANAGER         7839 1981-06-09       2450          
            10       7839 KING       PRESIDENT            1981-11-17       5000          0
            10       7934 MILLER     CLERK           7782 1982-01-23       1300          
            20       7566 JONES      MANAGER         7839 1981-04-02       2975          
            20       7902 FORD       ANALYST         7566 1981-12-03       3000          
            20       7876 ADAMS      CLERK           7788 1987-05-23       1100          
            20       7369 SMITH      CLERK           7902 1980-12-17        800          
            20       7788 SCOTT      ANALYST         7566 1987-04-19       3000          
            30       7521 WARD       SALESMAN        7698 1981-02-22       1250        500
            30       7844 TURNER     SALESMAN        7698 1981-09-08       1500          
            30       7499 ALLEN      SALESMAN        7698 1981-02-20       1600        300
            30       7900 JAMES      CLERK           7698 1981-12-03        950          
            30       7698 BLAKE      MANAGER         7839 1981-05-01       2850          
            30       7654 MARTIN     SALESMAN        7698 1981-09-28       1250       1400
    14 rows selected.
    SELECT CASE
              WHEN ROW_NUMBER () OVER (PARTITION BY deptno ORDER BY empno) =
                                                                         1
                 THEN deptno
           END deptno,
           empno, ename, job, mgr, hiredate, sal, comm
      FROM emp_test;
        DEPTNO      EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM
            10       7782 CLARK      MANAGER         7839 1981-06-09       2450          
                     7839 KING       PRESIDENT            1981-11-17       5000          0
                     7934 MILLER     CLERK           7782 1982-01-23       1300          
            20       7369 SMITH      CLERK           7902 1980-12-17        800          
                     7566 JONES      MANAGER         7839 1981-04-02       2975          
                     7788 SCOTT      ANALYST         7566 1987-04-19       3000          
                     7876 ADAMS      CLERK           7788 1987-05-23       1100          
                     7902 FORD       ANALYST         7566 1981-12-03       3000          
            30       7499 ALLEN      SALESMAN        7698 1981-02-20       1600        300
                     7521 WARD       SALESMAN        7698 1981-02-22       1250        500
                     7654 MARTIN     SALESMAN        7698 1981-09-28       1250       1400
                     7698 BLAKE      MANAGER         7839 1981-05-01       2850          
                     7844 TURNER     SALESMAN        7698 1981-09-08       1500          
                     7900 JAMES      CLERK           7698 1981-12-03        950          
    14 rows selected.Edited by: Salim Chelabi on 2009-09-14 08:13

  • Use of db sequence in a materialized view

    Hi,
    Will it be possible to use a database sequence in a materialized view?
    The materialized view is to return the result set of query that joins multiple tables. One of the columns in the result set - the to-be-created materialized view - is null and requires a sequence.
    Will it be possible to include a db sequence in the query?
    Example:
    create materialized view example_mview
    as
    select example_sequence.nextval, table1.'*', table2.'*'
    from example_table1 table1, example_table2 table2
    where table1.id=table2.id

    What is the purpose of such numbering? To number each row?
    If so - then use ROWNUM as 1st column.
    SQL>with ddd
           as
           (select 333 COL from dual union all select 5444 COL from dual)
           select rownum,COL from ddd;ROWNUM COL
    1 333
    2 5444

  • Refresh of a materialized view

    Hi All!
    I have a materialized view defined like:
    CREATE MATERIALIZED VIEW v_ship_info_new
    PCTFREE 5 PCTUSED 60
    TABLESPACE DATA_BIG
    STORAGE
    INITIAL 32768K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    USING INDEX STORAGE (INITIAL 2M NEXT 500K)
    REFRESH START WITH ROUND(SYSDATE + 1) + 08/24
    NEXT ROUND(SYSDATE + 2) + 08/24
    AS
    SELECT .....
    The view was created on Sep.-13-2005. I expected that the view will be refreshed today at 08:00 AM, but the last_ddl_time in user_objects is Sep.-18-2005 and the data in the view is also from Sep.-18-2005. There is no time filter in SELECT statement. The view should shows a result of left outer join of two tables.
    Any idea?
    Thanks,
    Andrej

    Andrej,
    You should consider the NEXT interval relative to the last materialized view refresh. Reading your materialized view definition it results that:
    - the materialized view was refreshed for the first time on 14-sep at 8:00 am (START WITH ROUND(SYSDATE + 1) + 08/24)
    - the materialized view is then refreshed on 16-sep at 8:00 am, 18-sep at 8:00 am (ROUND(SYSDATE + 2) + 08/24)
    Considering you have specified the START WITH clause in your command, the NEXT date should be considered starting from the timestamp of the last refresh and not from the moment of the materialized view creation.
    Regards,
    Adi

  • 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

  • Way to add an additional column that acts as a PK in a Materialized View?

    I want to create a materialized view that also has an index column. A unique number sequence assigned to each record. Is this even possible? Can a materialized view do this, and would the indexes stay the same on a refresh?
    Any help would be greatly appreciated.

    Materialized views are copies of data or aggregations. They can be used to replicate all or part of a table, or to replicate the result of a query against multiple tables. The big advantage they have is that unlike a standard view, which can return the same data, you can index the materialized view to improve performance. These indexes will be maintained and updated during the refresh process.
    Refer to Metalink document: 76673.1 or the Oracle Concepts manual for more information.

  • Problem when try to get the next refresh date of a materialized view

    I have a materialized view set to auto refresh(e.g hourly), I need to query this date and display in the report. I create a procedure which return the NEXT_DATE from the ALL_REFRESH_CHILDREN table, the procedure and the view all in schema HK3XDDB.
    If I login as sys, dba in the sql plus and query the procedure, it return the next date, but if I login as normal user which has permission to execute all procedures, it didn't return anything, so I change ALL_REFRESH_CHILDREN to USER_REFRESH_CHILDREN, still no luck. But the details from the USER_MVIEWS can be returned, just won't return anything in the REFRESH one. How to query the next date out?
    Another strange thing is, if I login as sys dba, it return the next date, but if I use a select next_date into statement in the procedure it will throw a data not found error.
    I stuck here for several hours just can't figure it out, any suggestions are welcome,
    Cheers

    Thank you for the reply. It's same with USER_REFRESH_CHILDREN, I can get the result when I run the procedure in SQL PLUS login as sys dba, but if I run the procedure using normal user which has permission to run any procedure, then nothing return. It might be a permission problem but I just can't figure out why.
    Let me explain in detailed:
    Schema HKXDDB, this schema has procedure TestProcedure, in the procedure, I have two ref cursor return, one is for select * from USER_JOBs (or from USER_REFRESH_CHILDREN, I have tried both), one is for select * From USER_MVIEWS, this schema has the materialized view. User HKDWUser has permission to run any procedures, so when this user run the TestProcedure which is own by HKXDDB, the cursor that select from USER_MVIEWS can return results which are materialized views owned by HKXDDB, but the cursor that select form USER_JOBS or USER_REFRESH_CHILDREN always return no rows.
    Any permission I need to assign to HKDWUSER to get the jobs or fresh group that owned by HKXDDB?
    Cheers

  • Materialized view taking long time to refresh

    I want to understand why materialized view refresh takes more time than running the sql for the materialized view.
    For example say I have a materialized view test_mv which is created as below; When I run just the select statement i get the result within 34 secs whereas if I try to refresh it using
    BEGIN
    DBMS_MVIEW.refresh ('wi_mv7_monthly','C',ATOMIC_REFRESH=>false);
    end;
    /This takes around 74 secs
    MV creation
    Oracle version : Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit 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_IDEdited by: user627047 on Sep 6, 2012 6:56 AM

    I want to understand why materialized view refresh takes more time than running the sql for the materialized view.Mview has to save the data as well .

  • Table and Materialized View in different namespaces?

    I've just faced something completly new for me. It appears that there are two objects with the same name and owner. Table and Materialized View have the same names and when I look into system dictionary I can se sth. like that:
    OWNER OBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE NAMESPACE
    USER_A USER_TABLE 159381 159381 TABLE 1
    USER_A USER_TABLE 159382 MATERIALIZED VIEW 19
    (I couldn't find how to write above with const length font).
    Two object in different namespace? I thought that Tables and Materialized Vievs have the same namespace.
    Can you please tell me how can I create objects to achieve above result? I would also be grateful if you tell me where to find that topic in documentation.

    Perfectly normal.
    SQL> select object_name, object_type from user_objects where object_name = 'TEST_MV';
    no rows selected
    SQL>
    SQL> create materialized view test_mv
      2  as
      3  select sysdate from dual;
    Materialized view created.
    SQL>
    SQL> select object_name, object_type from user_objects where object_name = 'TEST_MV';
    OBJECT_NAME                                        OBJECT_TYPE
    TEST_MV                                            TABLE
    TEST_MV                                            MATERIALIZED VIEW
    SQL>
    SQL> drop materialized view test_mv;
    Materialized view dropped.
    SQL>
    SQL> select object_name, object_type from user_objects where object_name = 'TEST_MV';
    no rows selected
    SQL>

Maybe you are looking for

  • Can I create a LaunchDaemon for my 3rd-party wireless card?

    Hi there, I wanted to get .11n wireless on my old Power Mac G5 (Quad 2.5) so I bought a third-party PCI-E card. It works fine, however it's not AirPort compatible, and so at present I have to run it from my Login Items, which in turn means the networ

  • Setting a data source for a tableView

    Greetings I'm trying to learn cocoa touch by following the Apple's code example called SQLiteBooks. there is a data source assignment within the MasterViewController code: - (void)loadView { tableView = [[[UITableView alloc] initWithFrame:[[UIScreen

  • Restrict PO at company code level

    Hi, We have near about 10 number of company code and lot of plants attached to each company code. and only one purchase organisation. Now business require that PO shold be created only for 2 company codes not for all. there are alreday roles availabl

  • HOW CHANGE SHOWDETAILITEM HEADER STYLE

    Hi guys, sorry for my english. I'm working with jdeveloper 11.1.1.5.0 and using jspx page to create an ADF application. The question is: I have a af:panelTabbed and can I change the style of the af:showDetailItem header (when it is disclosed and not)

  • Two way Partner determination using BP relationship

    HI, I have a simple requirement however i am not able to acheive it. There are two partner functions X and Y, and a relationship type Parent-Child Now if BP 1 is a parent of BP 2 , then when we enter BP 1 in any transaction BP 2 should be determined