Monitoring Refreshes
Monitoring Refreshes
=======================
The following queries can be used to monitor mview refreshes.
This is part of metelink note 258252.1 MATERIALIZED VIEW REFRESH: Locking, Performance, Monitoring
When an mview was last successfully refreshed
———————————————–
The following query will indicate when an mview was last successfully
refreshed and what type of refresh was done.
column last_refresh_type format a18
column owner format a7
column mview_name format a12
select owner, mview_name, last_refresh_type, last_refresh_date
from dba_mviews;
OWNERÂ Â MVIEW_NAMEÂ Â LAST_REFRESH_TYPEÂ LAST_REFRESH_DATE
——- ———— —————— ——————
SCOTTÂ Â CREF_DEPTÂ Â Â COMPLETEÂ Â Â Â Â Â Â Â Â Â 24-JAN-03 22:17:25
SCOTTÂ Â MYDEPTÂ Â Â Â Â Â FASTÂ Â Â Â Â Â Â Â Â Â Â Â Â Â 23-JAN-03 15:44:24
SCOTTÂ Â MY_EMPÂ Â Â Â Â Â FASTÂ Â Â Â Â Â Â Â Â Â Â Â Â Â 27-JAN-03 21:40:13
SCOTTÂ Â UPSNP_DEPTÂ Â COMPLETEÂ Â Â Â Â Â Â Â Â Â 24-JAN-03 14:35:37
Status of a Refresh Group Using the Job Queue
———————————————
The following query shows all the jobs scheduled in the job queue to perform
refreshes. It shows when the last refresh was run, the total amount of time
spent by the system running the job since the instance started, if the job is
broken or has failures, and when the next refresh will run.
column broken format a6
alter session set nls_date_format=’DD-MON-YY hh24:MI:SS’;
select job, last_date last_refresh,
next_date next_refresh, total_time,
broken, failures, what
from dba_jobs
where what like ‘%dbms_refresh%’;
JOB LAST_REFRESHÂ Â Â Â Â Â NEXT_REFRESHÂ Â Â Â Â Â TOTAL_TIME BROKENÂ Â FAILURES
—– —————— —————— ———- —— ———-
WHAT
————————————————————————
1 05-FEB-03 16:37:57 05-FEB-03 16:47:57Â Â Â Â Â Â Â Â Â 2 NÂ Â Â Â Â Â Â Â Â Â Â Â Â Â 0
dbms_refresh.refresh(’”SYS”.”REFRESHG1″‘);
Note: TOTAL_TIME - you can determine how long (in seconds) a refresh job takes
to run by querying total_time for the job before and after the job runs,
and calculating the difference. This is helpful in determining what
interval to use to stager refreshes.
Refreshes Currently Running
——————————–
The following query shows all refresh jobs that are currently running, when
they started, and if any have failed.
select r.job, r.this_date, r.failures
from all_jobs_running r, all_jobs j
where j.job = r.job
and j.what like ‘%dbms_refresh%’;
JOBÂ THIS_DATEÂ Â Â Â Â Â Â Â Â Â Â FAILURES
———- —————— ———-
1 05-FEB-03 16:37:57Â Â Â Â Â Â Â Â Â 0
If an mview belongs to a refresh group, you can also use the ALL_REFRESH
and ALL_REFRESH_CHILDREN to obtain information about the mview refresh
select r.rowner, r.rname, r.job, c.name,
r.next_date next_refresh, r.broken
from all_refresh r, all_refresh_children c
where r.job = c.job;
ROWNERÂ Â Â Â RNAMEÂ Â Â Â Â Â Â Â Â Â Â Â JOB NAMEÂ Â Â Â Â Â NEXT_REFRESHÂ Â Â Â Â Â BROKEN
———- ————— —– ———- —————— ——
SYSÂ Â Â Â Â Â Â REFRESHG1Â Â Â Â Â Â Â Â Â Â 1 MYDEPTÂ Â Â Â 05-FEB-03 16:47:57 N
Regards,
Tom


