About LAST_REFRESH_DATE in Materialized views

Hi, in the user_mviews view there is a field called LAST_REFRESH_DATE.
Does it show the time when the last refresh STARTED or when the last refresh FINISHED populating the materialized view?
Thanks in advance.

Yep, as Tekicora says: it's the time the last refresh started.
Ran a quick test ('cos I didn't know the answer) by creating a basic mview and refreshing it:
SQL> declare
  2  start_time CHAR(8);
  3  end_time CHAR(8);
  4  refresh_time CHAR(8);
  5  begin
  6  select to_char(sysdate,'HH24:MI:SS') into start_time from dual;
  7  dbms_mview.refresh('JJCMV');
  8  select to_char(sysdate,'HH24:MI:SS') into end_time from dual;
  9  select to_char(last_refresh_date,'HH24:MI:SS') into refresh_time from dba_mviews where mview_name = 'JJCMV'
10  dbms_output.put_line(start_time);
11  dbms_output.put_line(end_time);
12  dbms_output.put_line(refresh_time);
13* end;
SQL> /
20:37:22
20:46:36
20:37:23
PL/SQL procedure successfully completed.Pretty crude, but I think it demonstrates the answer.

Similar Messages

  • Fast Refresh Materialized View - failure

    Okay, this issue currently has me stumped. I searched the world wide web and still cannot seem to identify the cause of this issue.
    Here is the scenario:
    I created a materialized view log for the source table (let's say table1) found at DB1.
    I then create a materialized view (fast refresh, with logging) at a remote database (let's say DB2). The query for the MV is basic: select * from schema1.table1@db1_link;
    I set the materialized view to refresh every 30 seconds (for testing purposes).
    This creates a dbms job that executes every 30 seconds. The materialized view gets created successfully. I purposely enter new data into table1. The materialized view log for table1 successfully captures these changes. However, the materialized view found at DB2 does not get refreshed (updated) successfully.
    In fact, the dbms job errors-out. It keeps failing and failing. After 16 times, it gets marked as 'broken.'
    The error message is as such:
    RDBA WARNING: ORA-12012: error on auto execute of job 1472
    RDBA WARNING: ORA-00604: error occurred at recursive SQL level 3
    RDBA WARNING: ORA-01017: invalid username/password; logon denied
    RDBA WARNING: ORA-02063: preceding line from db1
    RDBA WARNING: ORA-06512: at "SYS.DBMS_SNAPSHOT", line 820
    RDBA WARNING: ORA-06512: at "SYS.DBMS_SNAPSHOT", line 877
    RDBA WARNING: ORA-06512: at "SYS.DBMS_IREFRESH", line 683
    RDBA WARNING: ORA-06512: at "SYS.DBMS_REFRESH", line 195
    RDBA WARNING: ORA-06512: at line 1
    The strange thing is, that the error supposedly claims invalid username/password. But I've used the db links successfully before & the username/password is not invalid. Has anyone encountered this issue before?

    Justin,
    From reading earlier posts about issues with materialized views, I remember reading something about materialized views (fast refreshable) not working with sysdate. What did you mean by such a statement? (I would copy & paste it here, but I am unable to find it at the moment).
    The reason I am curious, is the fact that I am setting my MV to refresh every 30 seconds let's say (for testing). At this moment - it starts failing & failing & failing.

  • Materialized View Refresh and I_SNAP$ Indexes issue

    At the time of doing REFRESH of the Materialized View, we are getting error like -
    SQL> EXECUTE DBMS_MVIEW.REFRESH('MV_TEST.MY_VIEW,'CF');
    BEGIN DBMS_MVIEW.REFRESH('MV_TEST.MY_VIEW,'CF'); END;
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-00001: unique constraint (MV_TEST.I_SNAP$_FIN_RESULT_EXPENSE1) violated
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2545
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2751
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2720
    ORA-06512: at line 1
    I tried to drop and recreate the index I_SNAP$_FIN_RESULT_EXPENSE1 but it didn’t helped.
    Later I dropped the index I_SNAP$_FIN_RESULT_EXPENSE1 and refreshed the materialized view and it was successful (obvious). But when I tried to recreate the index, I got the following error –
    SYS_OP_MAP_NONNULL("FIN_MULT"), SYS_OP_MAP_NONNULL("FIN_CD"))
    ERROR at line 8:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    When I look at the value of SYS_OP_MAP_NONNULL('FIN_CD'), it seems to be unique.
    SQL> select SYS_OP_MAP_NONNULL('FIN_CD') from dual;
    SYS_OP_MAP_NONNULL('FIN_CD’)
    46494E5F5650545F4C564C5F335F434400
    My questions are:
    1.     Why are the indexes (I_SNAP$_*) automatically created for?
    2.     What is the purpose of these (I_SNAP$_*) indexes?
    3.     What harm can be there if we drop these (I_SNAP$_*) indexes?
    4.     Why it is complaining about the Duplicate records / Uniqueness?
    5.     How to know where exactly the problem is in this case?
    6.     What is the solution for this problem? How to recreate these indexes successfully?
    Thanks!

    This forum is for the OLAP Option (which supports a cool featured called cube-organized materialized views). If this question if about table-based materialized views you should post it the General Oracle Database forum. Good luck.

  • A problem about ORA-12058 of materialized view

    consider the huge data of tableB, we make a decision about build materialized view using "on prebuilt table" parameter.
    create materialiezd view log on tableB rowid mode.
    when we create materialized view we got the error ORA-12058.
    Is there someone can tell us why?
    thank you very much我
    SQL> CREATE MATERIALIZED VIEW USERA.TABLEA
    3 REFRESH FORCE
    4 WITH ROWID
    5 AS SELECT * FROM USERB.TABLEB@DBLINK01 ;
    CREATE MATERIALIZED VIEW USERA.TABLEA
    ON PREBUILT TABLE
    REFRESH FORCE
    WITH ROWID
    AS SELECT * FROM USERB.TABLEB@DBLINK01
    ORA-12058: materialized view cannot use prebuilt table

    Hello SuperPianist,
    Please take a look at this document, and let me know if the troubleshooting steps help to resolve your microphone issues.
    Good luck!
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • All about Materialized views

    Hi,
    Can you please give me some link or info about Materilized view.I want to know in what cases Materilized views are most efficient.Can you also send me advantages and disadvantages of Materialized views
    Thanks
    Anand

    Data warehousing guide
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/toc.htm
    Four chapters:
    Basic materialized views
    Advanced materialized views
    Basic Query Rewrite
    Advanced Query Rewrite
    Gints Plivna
    http://www.gplivna.eu

  • I want detail info about materialized views?

    I want detail info about materialized views?

    The best place to start is the documentation available free online:
    http://www.oracle.com/pls/db102/

  • About Refresh Error In Materialized view

    hi
    i have
    Oracle 9.2.0.1 at the windows server 2003
    i have created some materialized view to use in my one web application running on tomcat
    i have scheduling for refresh it using refresh utility available in oracle materialized view snapshot refresh
    but when its try to run state of refresh become unusable and table according to it
    remains empty
    when i try to do it manually it gives error log
    Ora-12008 error in materialized view refresh path
    ora-01114 io error writing block to file 201(block #2621321)
    ora-27069 skgfdisp:attmempt to do i/o beyond the range of file
    osd-04026 invalid parameter passed(OS 2621327)
    ora-01114 io error writing block to file 201(block#2621321)
    ora-27069 skgfdisp:attempt do i/o beyond the range of the file
    osd-04026 invalid parameter passed (OS 2621327)
    ora 06512 at "SYS.DBMS_SNAPSHOt",line 794
    ora 06512 at "SYS.DBMS_SNAPSHOt", line 851
    ora 06512 at "SYS.DBMS_SNAPSHOt", line 832
    ora 06512 at line 2
    even i could not understand this error
    one strange thing in this when i restart my server and try to refresh
    it is going to be refresh
    please help me

    I suspect one of your datafiles has exceeded the 4Gb windows limit. Your tablespace has probably been set to autoextend and this has created the problem. I am not sure what you can do at this point apart from recover from backup. I would open a TAR with Oracle Support as soon as possible to try and resolve this issue.
    Please note: This forum is for OLAP issues only. If you need more information I would try posting on the database forum.
    Keith Laker
    Oracle EMEA Consulting
    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

  • A peculiar matter about Materialized Views

    Hi ,
    I have created successfully some months ago some MV. Later on , I was made to destroy the database and create a new one , using the DBCA. The peculiar is that whenever i issue the command :
    sql> drop materialized view stat_biox_f_mv;
    Oracle displays the error ORA-12003: the materialized view stat_biox_f_mv does not exist.
    When i issue the command:
    sql>create materialized view stat_biox_f_mv
    build immediate
    refresh start with (sysdate)+(10/1440)
    next (sysdate)+10/1440
    as
    select count(f) N_f,sum(f) Sx_f,round(avg(f),3) x_f,round(stddev(f),3) SD_f,
    round(avg(f)+2*stddev(f),3) Ru_f,round(avg(f)-2*stddev(f),3) Rd_f,
    round(stddev(f)/sqrt(count(f)),3) SE_f,round((100*stddev(f))/avg(f),3) CV_f,
    round(count(f)*((sum(power(f,4))-(power(sum(f),4)/count(f)))/
    (power((sum(power(f,2))-(power(sum(f),2)/count(f))),2)))-3,3) Sk_f,
    round((sum(power(f,2))-(power(sum(f),3)/count(f)))/
    (power(stddev(f),2)*count(f)),3) Sa_f
    from biox
    Oracle displays the error ORA-00955: the object does exist
    Eventually , the object exists or does not...?????
    Thanks , a lot
    Simon

    Have you queried all_objects? Perhaps the materialized view doesn't exist but a table with the same name does. If you do find any objects with that name, drop them.
    SELECT * FROM all_objects WHERE object_name = UPPER('stat_biox_f_mv');
    Have you tried creating this MV with a different name? Does that work?

  • I want to know about Materialized Views

    Hi,
    I am very new to this Oracle.
    In my project, we are using Materialized Views to refresh. but I am not having the good Idea on this. and in our project we golden gate also. both are refreshing purpose i think so. So could you please help me...
    Best Regards,
    Naresh.T

    user13405404 wrote:
    yes,
    I have gone through the pages. And please i ahve dought, like
    1)How it is going to be refreshed..?(Manuall/Auto)That depends on how you define the materialized view. You can (subject to various restrictions) have the materialized view refresh as part of the transaction that modifies the underlying tables, on a fixed schedule, or on demand.
    2)will occupie space(No, because its a view)A materialized view does occupy space. You are creating a copy of the underlying data.
    Justin

  • How to get a materialized view get to refresh itself after the job is "broken"

    we created a materialized view sometime ago with the following statement:
    create materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    as
    select  sxv_emp_cert_all.*
    from    sxv_employee_certification_all sxv_emp_cert_all;
    this week we found out it had not been refresh for about a month
    In dba_jobs the column broken was 'Y', next_date time something like 01-01-4000 and failures 16
    when I ran it manually by executing
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    I found that one of the columns was too small (probably a columns of one of the underlying tables had been extended since the creation of the materialized view)
    After fixing this I ussied yesterday (on 29-8-2013) the statement :
    alter materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    after this the table dba_jobs showed me 30-08-2013 04:00:00 as next date
    I was expecting it to run this night at 04:00, but it didn't
    the last_date column value was still from about a month ago, the column broken still shows 'Y'
    and the next date 30-08-2013 04:00:00 (while it should been set to 31-08-2013 01:00:00
    Rrunning
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    gave no errors this time
    and in User_Mview_Analysis the last_refresh_date column showed the date/time I had executed it
    Any idea how to get the job "unbroken" again so that the view refreshes itself every night?
    the database is Oracle Database 10g Release 10.2.0.4.0
    regards,
    Remco

    thanx for all your helpful and correct answers . but eventually I found it myself
    exec dbms_job.broken(<jobnumber>, false);

  • Refresh/Update data in a materialized view

    Hi,
    I have question about the data in a materialized view and how it is refreshed. My mat view has all my dimension-ids and my (for my specialize needs) aggregated measures from my fact table. I used the mat view wizard to create my view - which works perfectly. But now I wonder if I have to create some sort of mapping(?) or some sort of trigger to refresh the data in the mat view. Or is the data automatically refreshed when I start my fact table mappings. I use OWB 11gR2
    thx

    MVs have properties for refresh - you an refresh based on schedules or when dependent data is committed or manually.
    Cheers
    David

  • How do I figure where is the data in a materialized view coming from

    Hi: when I run select NAME, OWNER from dba_mview_refresh_times, I see a number of materialized views. How do I find more details about this view i.e where is the data coming from and which fields. The source table that is in another database changed. But the view on my database where the materialized view exist has not changed. I want to confirm from where is data coming in this view
    TIA
    Ravi

    SQL>  select * from dict where table_name like 'ALL%MVIEW%'
    TABLE_NAME                     COMMENTS                                                             
    ALL_BASE_TABLE_MVIEWS          All materialized views with log(s) in the database that the user can s
                                   ee                                                                   
    ALL_MVIEWS                     All materialized views in the database                               
    ALL_MVIEW_AGGREGATES           Description of the materialized view aggregates accessible to the user
    ALL_MVIEW_ANALYSIS             Description of the materialized views accessible to the user         
    ALL_MVIEW_COMMENTS             Comments on materialized views accessible to the user                
    ALL_MVIEW_DETAIL_PARTITION     Freshness information of all PCT materialized views in the database  
    ALL_MVIEW_DETAIL_RELATIONS     Description of the materialized view detail tables accessible to the u
                                   ser                                                                  
    ALL_MVIEW_DETAIL_SUBPARTITION  Freshness information of all PCT materialized views in the database  
    ALL_MVIEW_JOINS                Description of a join between two columns in the                     
                                   WHERE clause of a materialized view accessible to the user           
    ALL_MVIEW_KEYS                 Description of the columns that appear in the GROUP BY               
                                   list of a materialized view accessible to the user                   
    ALL_MVIEW_LOGS                 All materialized view logs in the database that the user can see     
    ALL_MVIEW_REFRESH_TIMES        Materialized views and their last refresh times  for each master table
                                    that the user can look at                                           
    ALL_REGISTERED_MVIEWS          Remote materialized views of local tables that the user can see      
    13 rows selected.

  • ORA-00600: internal error when delete master rows in a materialized view

    I have a materialized view in 11g2 on Redhat 5, defined asCREATE MATERIALIZED VIEW mv_idty
    PARALLEL BUILD IMMEDIATE REFRESH FAST ON COMMIT ENABLE QUERY REWRITE AS
    select IDTY_NAME_FIRST,IDTY_NAME_MIDDLE,IDTY_NAME_LAST,IDTY_NAME_SUFFIX,IDTY_SSN,
      IDTY_DR_LIC_NUM,IDTY_DR_LIC_STA,x.person_id,i.rowid i_rowid,x.rowid x_rowid
      from idty i,person_x_idty x where x.idty_id=i.idty_id; I deleted a few rows from the master tables and get error13:58:48 SQL> delete idty where  idty_id like 'test_row%' ;
    7 rows deleted.
    13:58:52 SQL> commit;
    commit
    ERROR at line 1:
    ORA-12008: error in materialized view refresh path
    ORA-00600: internal error code, arguments: [kkzfrfajv_markdml-1], [], [], [], [], [], [], [], [], [], [], [] I have other materialized views and they all delete master OK. This is the simplest one but causes problem. HELP!
    Edited by: user13148231 on Aug 11, 2010 5:45 PM

    Checked note 743766.1. It is not 100% relevant as it is about import, but the query is usefulselect sowner, vname, mowner, master from sys.snap_reftime$It reveals the materialized view some how based on other schema.
    Recreate the materialized view. problem solved.

  • Materialized view is not taking the Index

    Hi Friends,
      I have a materialized View for my Sales Details.  I created a view on the Materialized View and using in my report. The Performance is very slow. After little research,
    I found that the indexes are not used when the MV is accessed in the SQL.  I tried explain plan for a very simple query on the view to prove that.
    Here is my simple query.
    select month_num ,sum(qty) from v_mv_sales_table
    where month_num=201301
    by month_num;
    When I checked for count() it is considering the index and performance is good.
    select month_num ,count(*) from v_mv_sales_table
    where month_num=201301
    by month_num;
           Then I tried using hint for forcing the index. That time also it is working only for count not for SUM.
    select   /* +INDEX(tr, IDX2_MV_SALES_TABLE) */  month_num,count(*)
    v_mv_sales_table tr
    month_num=201301
    by month_num;
    Is there any way , I can force my sql to use the index on the month_num column?.
    I have a question about using hint to force the sql.
    My Question is  I have indexes on my Materialized View. But I am using the hint on my view based on the Mat View.
    Will it be okay to use like that?.
    You may ask why I am using View instead of using Mat View directly. At later stage we are planning to apply some user level restrictions to the data
    by linking the view to some other tables/view. So I am forced to use the View instead of MV.
    Any ideas or suggestions will be good
    Thanks in advance,
    Vimal....

    here's an example
    SQL> set autot off
    SQL>
    SQL> create table t
      2  (dt date)
      3  /
    Table created.
    SQL>
    SQL> insert into t
      2  select trunc (sysdate) + rownum
      3    from all_objects
      4  /
    25707 rows created.
    SQL>
    SQL>
    SQL> create index tidx on t (trunc (dt))
      2  /
    Index created.
    SQL>
    SQL> begin
      2     dbms_stats.gather_table_stats (user, 'T');
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL>
    SQL> set autot trace expl
    SQL> select *
      2    from t
      3   where dt = to_date ('24-07-2009', 'dd-mm-yyyy')
      4  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=1 Bytes=8)
       1    0   TABLE ACCESS (FULL) OF 'T' (Cost=6 Card=1 Bytes=8)
    SQL>
    SQL> select *
      2    from t
      3   where dt = trunc (sysdate)
      4  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=1 Bytes=8)
       1    0   TABLE ACCESS (FULL) OF 'T' (Cost=6 Card=1 Bytes=8)
    SQL>
    SQL> select *
      2    from t
      3   where trunc (dt) = trunc (sysdate)
      4  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=8)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'T' (Cost=2 Card=1 Bytes=
              8)
       2    1     INDEX (RANGE SCAN) OF 'TIDX' (NON-UNIQUE) (Cost=1 Card=1
    SQL>
    SQL>
    SQL> drop table t
      2  /
    Table dropped.
    SQL>

  • Time taken to Refresh a Materialized View

    Hi,
    Can we somehow estimate the approximate time it takes to Fast Refresh a particular Materialized View?
    In my case it is REFRESH FAST ON DEMAND and it contains close to 65 Million Records. On a daily basis 40K records are updated/inserted in the Materialized View. Also MV Logs are created on the Master Tables.
    The query of the MV is a join between a Dimension and Fact Table of a Datawarehouse. Each Master Table contains close to 70 million records.
    Could you please let me know?
    Thanks, Ketan

    Hi Jignesh,
    Thanks for the reply.
    Actually what I would like to know is can we somehow estimate/forecast the Refresh Time before actually refreshing the MV.
    Currently, in my case I am testing in a Non-Production Environment where the two MV logs contain 65K and just 70 records respectively. The Records finally Inserted/Updated from the MV is just 50. The time to refresh is about 7 minutes.
    However, in the Production Environment, I am expecting close to 25-30K Inserts/Updates from the MV. So, I would like to know if we could PREDICT the approximate time required to Refresh a far larger dataset?
    For example, to refresh close to 100K records in the View Logs will it take a far greater time or just some additional time? Is the Refresh rate directly dependent on the Number of Records to be refreshed or it takes a standard time to Refresh irrespective of the No. of Records?
    Would appreciate your inputs on this.
    Thanks, Ketan

Maybe you are looking for