I've created a materialized view between a primary system (Oracle 18c) and an external system (Oracle 19c):
create materialized view primary_system.workorder_mv
build immediate
refresh force
on demand
start with sysdate next sysdate + (30/(60*60*24))
as
select
cast(workorderid as number(38,0)) as objectid,
wonum,
status,
--other fields
longitudex,
latitudey
from
external_system.workorder_vw@gistomax --view in external system that is served up by dblink (gistomax)
--the view looks like this: select * from workorder where isgis=1
create materialized view log on external_system.workorder with rowid;
The docs say materialized views are supposed to purge automatically:
Oracle automatically tracks which rows in a materialized view log have
been used during the refreshes of materialized views, and purges these
rows from the log so that the log does not grow endlessly. Because
multiple simple materialized views can use the same materialized view
log, rows already used to refresh one materialized view might still be
needed to refresh another materialized view. Oracle does not delete
rows from the log until all materialized views have used them.
- I don't have any other materialized views that reference the MV logs.
- Here are the MV log properties (Toad).
- Here is what
all_registered_mviews
looks like. - The MV has been syncing successfully. If I create or update records in the WORKORDER table in the external system, the records get synced to the primary system on the 30-second schedule.
Question:
So far, the MV log data doesn't seem to be purging automatically:
Why aren't' the MV logs automatically purging once the records are synced?
Best Answer
Try basing your MV directly on the source table and not on an intermediate view. Include your "isgis=1" condition in the MV query.