1

I built a report for a customer 2 years ago that uses an overnight stored procedure to refresh the MVs associated with the report. This report is built off of very large scope of data/calculations, so there are multiple materialized views throughout the process, to help with data populating quicker. Since making a minor code change a month ago to just one view, it seems the overnight procedure refresh for the materialized views, isn't working properly, and am unsure why.

Stored Procedure that automatically runs overnight, every night:

create or replace PROCEDURE surge_refresh_procedure
IS
BEGIN
    DBMS_MVIEW.REFRESH('SCHEMA.COMBINE1_MV', method => 'C');
    DBMS_MVIEW.REFRESH('SCHEMA.SURGE_DET_MV', method => 'C');
    DBMS_MVIEW.REFRESH('SCHEMA.SURGE_A0A_MV', method => 'C');
    DBMS_MVIEW.REFRESH('SCHEMA.SURGE_REL_MV', method => 'C');
    DBMS_MVIEW.REFRESH('SCHEMA.SURGE_MET_MV', method => 'C');
END;

The materialized views are a direct select * from their associated views, which should be returning the same amount of results. When I run the statement select distinct srt from surge_det_v where srt2_date like '2020%', I return 3 results. When I run select distinct srt from surge_det_mv where srt2_date like '2020%', I return 6 results.

Another additional tidbit. If I do a manual refresh of CALL DBMS_MVIEW.REFRESH('SCHEMA.SURGE_DET_MV', method => 'C'); once I begin work the next morning, then that select distinct srt from surge_det_mv where srt2_date like '2020%' will actually refresh as it should, and return the 3 results. But when the stored procedure runs the next night, we're back to square one.

There weren't any changes to the stored procedure itself. I've tried recreating the procedure, by chance that would have repicked whatever is 'wrong' up, and still nothing. I've tried also dropping and recreating the MV in question, but still nothing.

Any ideas on why the stored procedure would all of a sudden not be catching the data properly?

KassieB
  • 135
  • 8
  • Have you checked that the job has actually run ? – Koen Lostrie Jun 29 '20 at 19:08
  • @KoenLostrie yeah, the job is running as scheduled every day. The refresh date/timestamps on the last 2 MVs are updating daily as well. – KassieB Jun 29 '20 at 20:01
  • What version of Oracle? Are any of the views on a database link, or are they all local? – Mark Stewart Jun 29 '20 at 20:24
  • @MarkStewart ... Oracle version 18.3.0. But should that matter if everything was working prior to the logic change, and the version being used hasn't changed? Just curious, not asking to be condescending. And all views are local. – KassieB Jul 01 '20 at 12:02
  • Asked the version as sometimes there are obscure bugs that affect certain versions, that only occur when certain logic is accessed. Slim chance, but still a chance. Have you looked at the `dba_mviews` data for the material views to see if anything peculiar in the columns `STALE_SINCE`, `REFRESH_MODE`, `LAST_REFRESH_TYPE`, `LAST_REFRESH_DATE`, etc.? – Mark Stewart Jul 01 '20 at 16:06

0 Answers0