|
V$system_event中Wait事件的一段话和resources_wait.sql(1)
V$SYSTEM_EVENT shows the total number of waits and timeouts, and the total waiting time recorded for each type of event, accumulated for all processes over the life of the instance. It is normal to order the events waited for in descending order of the total time waited, as an indicator of the potential severity of each type of wait. However, the total time waited is really only meaningful for those that indicate waiting for resources. If processes have been waiting because they have no work to do, then the time waited is immaterial. If they have been waiting for routine operations, sUCh as disk I/O, then the total time waited will depend on the workload. In such cases, the average time waited is much more interesting than the total time waited. This classification of wait types into idle waits, routine waits, and resource waits is vital to a correct understanding of the wait statistiCS. Accordingly, APT has separate scripts for resource waits and routine waits, and ignores idle waits altogether. The routine_waits.sql script shows only the average time waited for each type of routine wait. The resource_waits.sql script (see Example 2.1) shows the types of resources waited for in descending order of the total time waited, but also shows the average time waited.
resources_wait.sql:
----------------------------------------------------------------------------------- Script:resource_waits.sql-- Purpose:to show the total waiting time for resource types---- Copyright:(c) 1998 Ixora Pty Ltd-- Author:Steve Adams---------------------------------------------------------------------------------@reset_sqlpluscolumn average_wait format 9999990.00selectsubstr(e.event, 1, 40)event,e.time_waited,e.time_waited / ( e.total_waits - decode(e.event, 'latch free', 0, e.total_timeouts))average_waitfromsys.v_$system_evente,sys.v_$instanceiwheree.event = 'buffer busy waits' ore.event = 'enqueue' ore.event = 'free buffer waits' ore.event = 'global cache freelist wait' ore.event = 'latch free' ore.event = 'log buffer space' ore.event = 'parallel query qref latch' ore.event = 'pipe put' ore.event = 'write complete waits' ore.event like 'library cache%' ore.event like 'log file switch%' or( e.event = 'row cache lock' and i.parallel = 'NO')union allselect'non-routine log file syncs',round(e.average_wait * greatest(e.total_waits - s.value, 0)),e.average_waitfromsys.v_$system_event e,sys.v_$sysstat swheree.event = 'log file sync' ands.name = 'user commits'order by2 desc/@reset_sqlplus其中和reset_sqlplus是:
|