Beruflich Dokumente
Kultur Dokumente
Agenda
Introduction to Wait events Components Common Wait Events Interpreting Common I/O Related Wait events Interpreting Locks Related Wait Events Interpreting Common Latency Related Wait Events Dumps and Traces
Components
The OWI (Oracle Wait Interface) is a collection of a few dynamic performance views and an extended SQL trace file.
Parameter TIMED_STATISTICS must be set to TRUE This parameter does not add any appreciable overhead to your database performance.
Components
The following 4 views are the key components of the OWI V$EVENT_NAME V$SESSION_WAIT V$SESSION_EVENT V$SYSTEM_EVENT
Components
Oracle 10G adds the following V$SESTEM_WAIT_CLASS V$SESSION_WAIT_CLASS V$SESSION_WAIT_HISTORY V$EVENT_HISTOGRAM V$ACTIVE_SESSION_HISTORY
Components
The V$EVENT_NAME is a non-dynamic view that contains all the wait events defined in your database.
SQL> descr v$event_name Name Null? Type ----------------------------------------- -------- ---------------------------EVENT# NUMBER EVENT_ID NUMBER NAME VARCHAR2(64) PARAMETER1 VARCHAR2(64) PARAMETER2 VARCHAR2(64) PARAMETER3 VARCHAR2(64) WAIT_CLASS_ID NUMBER WAIT_CLASS# NUMBER WAIT_CLASS VARCHAR2(64)
Components
The V$SYSTEM_EVENT view displays aggregated statistics of all wait events encountered by all Oracle sessions.
SQL> descr v$system_event Name Null? Type ----------------------------------------- -------- ---------------------------EVENT VARCHAR2(64) TOTAL_WAITS NUMBER TOTAL_TIMEOUTS NUMBER TIME_WAITED NUMBER AVERAGE_WAIT NUMBER TIME_WAITED_MICRO NUMBER EVENT_ID NUMBER
Components
The V$SESSION_EVENT contains aggregated wait events stats by session for all sessions currently connected.
SQL> descr v$session_event; Name Null? Type ----------------------------------------- -------- ---------------------------SID NUMBER EVENT VARCHAR2(64) TOTAL_WAITS NUMBER TOTAL_TIMEOUTS NUMBER TIME_WAITED NUMBER AVERAGE_WAIT NUMBER MAX_WAIT NUMBER TIME_WAITED_MICRO NUMBER EVENT_ID NUMBER
Components
The V$SESSION_WAIT view provides detailed information about the event or resource that each session is waiting for. This is a real time view.
(Note in 10G the v$session_wait is wholely incorporated into the v$session view, so you will not need to do a join to get the session info.)
Components
SQL> descr v$session_wait; Name Type --------------------------------- ------------------SID NUMBER SEQ# NUMBER EVENT VARCHAR2(64) P1TEXT VARCHAR2(64) P1 NUMBER P1RAW RAW(8) P2TEXT VARCHAR2(64) WAIT_CLASS_ID NUMBER WAIT_CLASS# NUMBER WAIT_CLASS VARCHAR2(64) WAIT_TIME NUMBER SECONDS_IN_WAIT NUMBER STATE VARCHAR2(19)
Components: Tracing
Trace event 10046 The extended SQL Trace. When you cant monitor events interactively, you can diagnose a performance problem by recording the wait events in a trace file for more detailed analysis.
Components: Tracing
You can enable trace event 10046 at the instance level or at the session level Set the event parameter, and restart the instance for the instance level. (Do not do this!!!)
Event=10046 tace name contex forever, level 8
Components: Tracing
When you want to trace someone elses session Exec dbms_support.start_trace_in_session (sid=>xxx, serial#=>, waits=>true, binds=>true); Use the stop_trace_in_session to end your tracing.
Components: Tracing
To find your trace file look in the user_dump_dest directory. You can list the directory contents by time, one of the most recent will be your trace file. You can also use tracefile_identifer to name your trace file for easy referencing Alter session set tracefile_identifier=Tracefilesql1 Once you find your trace file tkprof utility (Transient Kernel Profiler) will summarize the wait events.
OWI Limitations
No CPU Statistics No end-to-end visability No historical data you much capture and create your own history. Some inaccuracies when computing total time time rounded/ centisecond unit of measurement too course grained for todays fast computers.
Interpreting Common Wait Events: How Do I find and fix the Problems?
This lock can also occur if the application issues an explicit LOCK TABLE command Query the V$SQLAREA for this statement.
Additional Topics
Wait events in 10G new additions Wait events in a RAC environment.
Summary
Become familiar with the various views used to diagnose any waits occuring in your database. Set up an historical tracking system so that you can respond to the questions of What Happened after the fact. Become familiar with the most common wait events and what the causes are.
References
www.hotsos.com - Why are Oracles read events named backwards? www.ioug.org - If your memory serves you right
Q U E S T I O N S A N S W E R S