Professional Documents
Culture Documents
Improvements
Kirtikumar Deshpande
1
Agenda
Brief history of Oracle Wait Interface (OWI)
Q &A
2
Brief History of OWI
Introduced in Oracle 7.0.12
Four V$ views:
– V$SYSTEM_EVENT
– V$SESSION_EVENT
– V$SESSION_WAIT
– V$EVENT_NAME
Classification
based on solution to correct
problematic wait events
12 Wait Classes
7
Enhanced V$EVENT_NAME View
8
V$EVENT_NAME
9
Wait Classes & Nbr of Events
CLASS NBR_EVENTS
--------------- ----------
Administrative 42
Application 11
Cluster 45
Commit 1
Concurrency 17
Configuration 21
Idle 59
Network 25
Other 557
Scheduler 2
System I/O 19
User I/O 12
10
10g R1 HP-UX 11.11
Wait Classes - Examples
Administrative (DBA tasks affecting others)
– Buffer pool resize
– Offline rollback segment
– Index rebuilds
Application
– Row level locks or explicit locks
Commit
– Redo log write confirmation
Concurrency
– Buffer busy waits
– Library cache latch
11
Wait Classes - Examples
Configuration
– Sizing for log buffer, log files, SGA components
– Contention for ST enqueue
Network
– More data to/from database link/client
– Remote archive destination
User I/O
– Database file reads, single writes,
– Direct path reads and writes
– BFILE reads
12
Wait Classes - Examples
System I/O
– Redo log writes
– Archiving redo logs
– Control file writes
Idle
– Indicates that session is inactive, waiting for
more work
13
Enhanced OWI Views
New Columns:
– V$SYSTEM_EVENT
EVENT_ID NUMBER
– V$SESSION_EVENT
EVENT_ID NUMBER
– V$SESSION_WAIT
WAIT_CLASS_ID NUMBER
WAIT_CLASS# NUMBER
WAIT_CLASS VARCHAR2(64)
14
Enhanced V$SESSION View
Includes following columns from V$SESSION_WAIT
SEQ# NUMBER
EVENT# NUMBER
EVENT VARCHAR2(64)
P1TEXT VARCHAR2(64)
P1 NUMBER
P1RAW RAW(8)
P2TEXT VARCHAR2(64)
P2 NUMBER
P2RAW RAW(8)
P3TEXT VARCHAR2(64)
P3 NUMBER
P3RAW RAW(8)
WAIT_CLASS_ID NUMBER
WAIT_CLASS# NUMBER
WAIT_CLASS VARCHAR2(64)
WAIT_TIME NUMBER
SECONDS_IN_WAIT NUMBER
15
STATE VARCHAR2(19)
Enhanced V$SESSION View
No need to join V$SESSION_WAIT to V$SESSION
In this example:
– RWO# shows the object number the session is accessing
– RWF# shows the absolute file number the session is accessing
– Event for SID 38 shows the type of Enqueue the session is waiting for
17
Number of Wait Events
Over 800 wait events
20
V$SESSION_WAIT_HISTORY
Shows 10 most recent waits for the session
No need to repetitively query V$SESSION_WAIT view
SID NUMBER
SEQ# NUMBER 1 to 10 (latest oldest)
EVENT# NUMBER
EVENT VARCHAR2(64)
P1TEXT VARCHAR2(64)
P1 NUMBER
P2TEXT VARCHAR2(64)
P2 NUMBER
P3TEXT VARCHAR2(64)
P3 NUMBER
WAIT_TIME NUMBER 0 = waiting @snapshot time
WAIT_COUNT NUMBER 21
V$SESSION_WAIT_HISTORY
10 rows selected.
22
V$EVENT_HISTOGRAM
Histogram of
– Number of waits, maximum wait, wait time for each
event
What’s missing?
24
V$EVENT_HISTOGRAM
EVENT# EVENT WAIT_TIME_MILLI WAIT_COUNT
------- ----------------------- --------------- ----------
294 db file sequential read 1 29453
294 db file sequential read 2 7319
294 db file sequential read 4 749
294 db file sequential read 8 904
294 db file sequential read 16 3395
294 db file sequential read 32 2167
294 db file sequential read 64 270
294 db file sequential read 128 56
294 db file sequential read 256 16
294 db file sequential read 512 9
295 db file scattered read 1 13397
295 db file scattered read 2 2202
295 db file scattered read 4 881
295 db file scattered read 8 822
295 db file scattered read 16 672
295 db file scattered read 32 523
295 db file scattered read 64 228 25
V$FILE_HISTOGRAM
FILE# SINGLEBLKRDTIM_MILLI SINGLEBLKRDS
---------- -------------------- ------------
5 1 5608
5 2 401
5 4 96
5 8 41
5 16 53
5 32 23
5 64 10
5 128 3
5 256 5
5 512 1
10 rows selected.
26
V$TEMP_HISTOGRAM
FILE# SINGLEBLKRDTIM_MILLI SINGLEBLKRDS
---------- -------------------- ------------
1 1 26
1 2 1
1 4 0
1 8 0
1 16 0
1 32 2
6 rows selected.
27
V$SYSTEM_WAIT_CLASS
Instance level waits by Wait Class
28
V$SYSTEM_WAIT_CLASS
Name Type
-------------------- -----------
WAIT_CLASS_ID NUMBER
WAIT_CLASS# NUMBER
WAIT_CLASS VARCHAR2(64)
TOTAL_WAITS NUMBER
TIME_WAITED NUMBER
29
V$SYSTEM_WAIT_CLASS
WAIT_CLASS_ID WC# WAIT_CLASS TOTAL_WAITS TIME_WAITED
------------- ---- ---------------- ----------- -----------
3875070507 4 Concurrency 270 1596
3290255840 2 Configuration 378 1222
4217450380 1 Application 3680 321401
1893977003 0 Other 10394 65063
3386400367 5 Commit 28164 17657
1740759767 8 User I/O 72340 22764
2000153315 7 Network 79141 200
4108307767 9 System I/O 206748 174050
2723168908 6 Idle 1156193 364114196
9 rows selected.
31
V$SESSION_WAIT_CLASS
Name Type
------------------- -------------
SID NUMBER
SERIAL# NUMBER
WAIT_CLASS_ID NUMBER
WAIT_CLASS# NUMBER
WAIT_CLASS VARCHAR2(64)
TOTAL_WAITS NUMBER
TIME_WAITED NUMBER
32
V$SESSION_WAIT_CLASS
Sample output for WAIT_CLASS# = 8
10 rows selected.
33
V$SESSION_WAIT_CLASS
Sample output for SID = 42
7 rows selected.
34
V$ACTIVE_SESSION_HISTORY
Shows Sampled Active Session Activity, including waits
Name Type
----------- -----------------------
SID NUMBER
STAT_ID NUMBER
STAT_NAME VARCHAR2(64)
VALUE NUMBER
37
V$SESS_TIME_MODEL
SID STAT_NAME VALUE
--- ---------------------------------------- ----------
40 DB time 19376451
40 DB CPU 11492220
40 background elapsed time 0
40 background cpu time 0
40 sequence load elapsed time 0
40 parse time elapsed 62228
40 hard parse elapsed time 51538
40 sql execute elapsed time 19291646
40 connection management call elapsed time 36309
40 failed parse elapsed time 0
40 failed parse (out of shared memory) elap 0
40 hard parse (sharing criteria) elapsed ti 0
40 hard parse (bind mismatch) elapsed time 0
40 PL/SQL execution elapsed time 1508
40 inbound PL/SQL rpc elapsed time 0
40 PL/SQL compilation elapsed time 0
40 Java execution elapsed time 0
17 rows selected 38
E2E Extended SQL Tracing
Trace Event 10046 with level 8, 12
End to End Application Tracing by
– SID, SERIAL#
– Service Name
– Application Module
– Application Action
– Client Identifier
DBMS_MONITOR Package Procedures
Utility – trcsess
39
Tracing for SID, SERIAL#
EXEC DBMS_MONITOR.SESSION_TRACE_ENABLE –
( session_id => 40, -
serial_num => 98, -
waits => true, -
binds => true );
EXEC DBMS_MONITOR.SESSION_TRACE_DISABLE –
( session_id => 40, -
serial_num => 98 );
40
Tracing for Service, Module, Action
Service Name must be set
– Init.ora parameter: SERVICE_NAMES
– TNSNAMES.ora parameter: SERVICE_NAME
– V$SESSION shows SERVICE_NAME
Defaults:
– SYS$BACKGROUND (for all Oracle BG processes)
– SYS$USERS (for all User processes)
Default
– Module
‘SQL*Plus’ for connections via SQL*Plus
Client program name
– Action
None
42
Tracing for Service, Module, Action
EXEC DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE –
( service_name => ‘APPS1’, -
module_name => ‘GLEDGER’, -
action_name => ‘DEBIT_ENTRY’, -
waits => true, -
binds => true, -
instance_name => null );
EXEC DBMS_MONITOR.SERV_MOD_ACT_TRACE_DISABLE –
( service_name => ‘APPS1’, -
module_name => ‘GLEDGER’, -
action_name => ‘DEBIT_ENTRY’, -
waits => true, -
binds => true, -
instance_name => null );
43
Tracing for Client Identifier
Client Identifier must be set by the Application
– OCI attribute OCI_ATTR_CLIENT_INFO
– DBMS_APPLICATION_INFO.SET_CLIENT_INFO
– DBMS_SESSION.SET_IDENTIFIER
– V$SESSION shows CLIENT_IDENTIFIER
EXEC DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE -
( client_id => ‘KirtiD’, -
waits => true, -
binds => true );
EXEC DBMS_MONITOR.CLIENT_ID_TRACE_DISABLE -
( client_id => ‘KirtiD’);
44
Utility – trcsess
Consolidates trace information into one output file from
multiple trace files
Options:
– Session Id
– Client Id
– Service
– Module
– Action 45
Utility – trcsess
Syntax:
46
Oracle10g: Wait Interface
Improvements
Q&A
47