Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

on commit materialized view shows unusable

Phil GSep 21 2020 — edited Sep 23 2020

Dear friends

oracle db 19.3

I have a fast refresh on commit materialised view such as :

create materialized view stock_total_mv

build immediate

refresh fast

on commit

enable query rewrite

as select sum(qty),sum(qty_reserved),count(1) count

from stock;

When I do quite a lot of inserts (including gather table stats after) of new stock records all is fine.

I can see the in :

select     mview_name,staleness

from       all_mviews m

where    owner             = <myowner>

and        mview_name = 'STOCK'

this shows a status of 'FRESH

however after a number of updates to the underlying stock quantity (including gather table stats after)  the above query shows a status of UNUSABLE.

the materialised view does however remain usable.

The only way I have found to clear this unusable status is to do a full refresh of the materialised view which seems to defeat the purpose of the refresh fast on commit.

I have tried gathering stats on the mview.

Am I missing something with this staleness of UNKNOWN

This post has been answered by Sven W. on Sep 22 2020
Jump to Answer
Comments
Post Details
Added on Sep 21 2020
11 comments
2,391 views