问题
So I've got a materalized view (I know...) :
CREATE MATERIALIZED VIEW vw_my_view_here
REFRESH COMPLETE START WITH SYSDATE NEXT SYSDATE + 1/24 AS
/*huge-ass select statement here*/
UNION ALL
/*huge-ass select statement here*/
UNION ALL
/*huge-ass select statement here*/
UNION ALL
/*huge-ass select statement here*/
This has been present in our system for some time without causing issues. One of these select queries is broken (somehow - presumibly schema changes in the underlying tables) and has taken to running for 24 hours straight and consuming all of the boxes resources. This is a problem for the other things on the box.
I can't drop or modify the view - as it's completely undocumented (I know...) and I need to figure out who consumes it, how it's populated, etc. first.
I tried killing the process that's handling the query, but it seems another query is fired straight away afterwards.
How can I stop the materialized view without 1) dropping the view and (2) without refreshing the view (because that's taking 24+ hours and all of our box resources).
I've tried running
alter materialized view view_name refresh on demand;
but it seems to just run endlessly with no effect on the original massive query.
Any ideas?
回答1:
The documentation for altering the refresh settings says:
This clause only sets the default refresh options. For instructions on actually implementing the refresh, refer to Oracle Database Advanced Replication and Oracle Database Data Warehousing Guide.
So your alter materialized view statement is not doing a refresh itself. It is just waiting for the currently-excuting refresh to complete before it can update the data dictionary for that view. Once the current refresh completes (or is terminated) the alter will complete and prevent further automatic refreshes from being started.
来源:https://stackoverflow.com/questions/40484564/oracle-11g-broken-materialized-view-stop-refresh-without-dropping-view-or-refre