Stop materialized view refresh

       Principle: To pause materialized view being refreshed only need to kill the corresponding session just fine, but the timing materialized view refresh is performed through job oracle, after which the session is kill, job materialized view refresh operation is executed again, so the kill need job status is set to Y broken before the session, indicating that the failure of the task, and then perform the kill session.

Out step by step

1. The following sql statement can know which job is currently being planned, mainly to see BROKEN state, Broken consider this column indicates whether the job continues, job broken = Y is not going to continue to perform.


  
  
  1. SELECT J.JOB, J.PRIV_USER, R.ROWNER, R.RNAME, J.BROKEN
  2. FROM DBA_REFRESH R, DBA_JOBS J
  3. WHERE R.JOB = J.JOB
  4. ORDER BY 1 ;

2. Remove the job corresponding to the query from the above step sql, and materialized views refresh job is broken is provided in the command window is performed as Y, Method:

exec dbms_job.broken(job,true);
  
  

Such as:

exec dbms_job.broken(824,true);

Then commit the transaction. And then re-test job whether it is broken up

 

3. The following statement by the job through and see which job is currently running, mostly found being refreshed materialized view job:

SELECT * FROM V$MVREFRESH;
  
  

4.kill out the corresponding session, sid, serial # Step 3 may be obtained from:


  
  
  1. alter system kill session 'sid,serial#';

Such as:

alter system kill session '144,726';

 

Here the refresh operation has been suspended, unless you mark job is broken again set to Y. Of course, deleting materialized view itself will be removed in the job queue job.

[Sic] (https://blog.csdn.net/lzc1993lzc/article/details/84105922)

Guess you like

Origin blog.csdn.net/yuan1164345228/article/details/95525097