Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7672707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:20:54+00:00 2026-05-31T16:20:54+00:00

I have a data mart mastered from our OLTP Oracle database using basic Materialized

  • 0

I have a data mart mastered from our OLTP Oracle database using basic Materialized Views with on demand fast refresh capability. Refresh is working fine. What I am interested in adding are some statistics about the refresh of each Materialized View, such as the number of inserts, updates, and deletes that were applied to the master table since the last refresh like that data I can find in user_tab_modifications. Is this possible for Materialized Views?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:20:56+00:00Added an answer on May 31, 2026 at 4:20 pm

    Prior to doing the refresh, you could query the materialized view log to see what sort of change vectors it stores. Those will be the change vectors that need to be applied to the materialized view during the refresh process (assuming that there is just one materialized view that depends on this materialized view log).

    For example, if I create my table, my materialized view log, and my materialized view.

    SQL> create table foo( col1 number primary key);
    
    Table created.
    
    SQL> create materialized view log on foo;
    
    Materialized view log created.
    
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  create materialized view mv_foo
      2    refresh fast on demand
      3  as
      4  select *
      5*   from foo
    SQL> /
    
    Materialized view created.
    
    SQL> insert into foo values( 1 );
    
    1 row created.
    
    SQL> insert into foo values( 2 );
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    

    Now, I refresh the materialized view and verify that the table and the materialized view are in sync

    SQL> exec dbms_mview.refresh( 'MV_FOO' );
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from user_tab_modifications where table_name = 'MV_FOO';
    
    no rows selected
    
    SQL> select * from foo;
    
          COL1
    ----------
             1
             2
    
    SQL> select * from mv_foo;
    
          COL1
    ----------
             1
             2
    

    Since the two objects are in sync, the materialized view log is empty (the materialized view log will be named MLOG$_<<table name>>

    SQL> select * from mlog$_foo;
    
    no rows selected
    

    Now, if I insert a new row into the table, I’ll see a row in the materialized view log with a DMLTYPE$$ of I indicating an INSERT

    SQL> insert into foo values( 3 );
    
    1 row created.
    
    SQL> select * from mlog$_foo;
    
          COL1 SNAPTIME$ D O
    ---------- --------- - -
    CHANGE_VECTOR$$
    --------------------------------------------------------------------------------
         XID$$
    ----------
             3 01-JAN-00 I N
    FE
    2.2519E+15
    

    So you could do something like this to get the number of pending inserts, updates, and deletes.

    SELECT SUM( CASE WHEN dmltype$$ = 'I' THEN 1 ELSE 0 END ) num_pending_inserts,
           SUM( CASE WHEN dmltype$$ = 'U' THEN 1 ELSE 0 END ) num_pending_updates,
           SUM( CASE WHEN dmltype$$ = 'D' THEN 1 ELSE 0 END ) num_pending_deletes
      FROM mlog$_foo
    

    Once you refresh the materialized view log, however, this information is gone.

    On the other hand, USER_TAB_MODIFICATIONS should track the approximate number of changes that have been made to the materialized view since the last time that statistics were gathered on it just as it would track the information for a table. You’ll almost certainly need to call DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO to force the data to be made visible if you want to capture the data before and after the refresh of the materialized view.

    SELECT inserts, updates, deletes
      INTO l_starting_inserts,
           l_starting_updates,
           l_starting_deletes
      FROM user_tab_modifications
     WHERE table_name = 'MV_FOO';
    
    dbms_mview.refresh( 'MV_FOO' );
    dbms_stats.flush_database_monitoring_info;
    
    SELECT inserts, updates, deletes
      INTO l_ending_inserts,
           l_ending_updates,
           l_ending_deletes
      FROM user_tab_modifications
     WHERE table_name = 'MV_FOO';
    
    l_incremental_inserts := l_ending_inserts - l_starting_inserts;
    l_incremental_updates := l_ending_updates - l_starting_updates;
    l_incremental_deletes := l_ending_deletes - l_starting_deletes;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to pull data from our Oracle datamart into R using RODBC.
I have data coming from the database in the form of a DataSet .
I have data from a table in a database (string) that contain text and
I have data being imported from a database and I would like to represent
i have data structure i am passing this from server to client using data
I have data in a MySQL database. I am sending the user a URL
I have data from MySQL showing all organisations a customer got, with all details
I have data in an MYSQL database that looks like this: Project Date Time
I have data stored as below in an MS Access database: Date User 20090101
I have data in my database like this: Alice anderson Beatrice benny Carmen calzone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.