V $ SYSTEM_EVENT shows the total number of waits and timeouts, and the totalwaiting time recorded for each type of event, accumulated for all processes overthe life of the instance. It is normal to order the events waited for in descendingorder of the total time waited, as an indicator of the potential severity of eachtype of wait.However, the total time waited is really only meaningful for those that indicatewaiting for resources. If processes have been waiting because they have no workto do, then the time waited is immaterial. If they have been waiting for routineoperations, such as disk I / O, then the total time waited will depend on theworkload. In such cases, the average time waited is much more interesting thanthe total time waited.This classification of wait types into idle waits, routine Waits, And Resource Waitsis Vital to a Correct Understanding of the Wait Statistics. Accordingly, Apt HasseParate Scripts for Resource Waits And Routine Waits, and Ignores Idle Waitsaltogether. th e routine_waits.sql script shows only the average time waited foreach type of routine wait. The resource_waits.sql script (see Example 2.1) showsthe types of resources waited for in descending order of the total time waited, butalso 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_sqlplus
COLUMN AVERAGE_WAIT FORMAT 9999990.00
SELECT
Substr (EVENT, 1, 40) Event,
E.Time_WaITED,
e.time_waited /
E. TOTAL_WAITS - DECODE (EVENT, 'LATCH FREE', 0, E.TOTAL_TIMEOUTS) AVERAGE_WAIT
From
Sys.v_ $ system_event E,
SYS.V_ $ INSTANCE I
WHERE
Event = 'buffer busy waits' OR
Event = 'enqueue' OR
Event = 'free buffer waits' or
Event = 'Global Cache Freelist Wait' OR
EVENT = 'Latch Free' OR
EVENT = 'log buffer space' OR
EVENT = 'Parallel Query Qref Latch' OR
EVENT = 'Pipe Put' OR
Event = 'Write Complete Waits' OR
Event Like 'Library Cache% OR
EVENT LIKE 'LOG FILE SWITCH%' OR
(Event = 'Row Cache Lock' and
I.PARALLEL = 'NO'
)
Union all
SELECT
'Non-Routine Log File Syncs',
Round (E.AVERAGE_WAIT * GREATEST (E.TOTAL_WAITS - S.VALUE, 0)),
E.average_wait
From
Sys.v_ $ system_event E,
Sys.v_ $ sysstat s
WHERE
EVENT = 'log file sync' and
S.name = 'user commits'
ORDER BY
2 DESC
/
@Reset_sqlplus
Among them, RESET_SQLPLUS is: ------------------------------------------- ----------------------------------
-
- Script: reset_sqlplus.sql
- Purpose: To RESET SQLPLUS SETTINGS
-
- Copyright: (C) 1998 Ixora Pty Ltd
- Author: Steve Adams
-
-------------------------------------------------- -----------------------------
Clear Breaks
Clear columns
Clear Computes
Set feedback off
SET VERIFY OFF
Source: Oracle8i Internal Services