0% found this document useful (0 votes)
18 views119 pages

Schema Hotsos

Uploaded by

Gamer Advaith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views119 pages

Schema Hotsos

Uploaded by

Gamer Advaith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 119

To Do

ADDM – add chart showing advice over time


Client id – draw sessions and client bouncing from
session to session
Services – show connection diagram
Get John’s screen shot
Talk about SQL tuning on SQL details
Show group bys with ASH by various axes
Show examples of setting client_id, service, turning
on
More test cases, what does ADDM find
Performance Tuning in Oracle 10g
Kyle Hailey
EM Product Layout for Performance

Database Home Page

Database Performance Page

Drilldowns

SQL Session
EM Pages Layout

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


Buffer Busy Waits Use Case
Three Paths

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


ADDM Path

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


Database Home Page
ADDM Home

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


ADDM Home
ADDM Details

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


ADDM Details
Manual Path

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


Database Home Page
Database Home Page
Database Home Page
Performance Page

Home Page

Perf Page ADDM

Top Session Top SQL Wait Detail ADDM Details

SQL Detail Session Detail


Database Performance Page
Database Performance Page highlight
Wait Drill Down

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


Wait Drill Down
Wait Drill Down
Wait Drill Down
Wait Drill Down highlight
Wait Drill Down – Top SQL
SQL Details

Home Page

Perf Page ADDM

Top Session Wait Detail Top SQL ADDM Details

SQL Detail Session Detail


SQL Details
New Features
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
Metrics
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
Metrics Motivation

Performance Statistics
Indicators of Database performance
Cumulative Counters since DB Start
Not Much use in raw form
Querying Statistics

Select value from v$sysstat where


name=‘physical reads’;
SQL> /
VALUE
---------------
1,533,787
SQL>
Statistics are Cumulative

v$sysstat
physical reads

Statistics just
keep growing
How many Physical Reads/Sec

v$sysstat
physical reads
1.5M

What is the rate


here?

Statistics just keep


growing
Low IO

v$sysstat
physical reads
1.5M

30 minutes

IO’s

time
High IO - same cumulative

v$sysstat
physical reads
1.5M

IO’s

30 minutes

time
Need Deltas to get Rates
Take value at time A
Take value at time B
Rate = (B-A)/elapsed time
Current Methods
Utlbstat.sql/Utlestat.sql
– Creates tables, inserts, deletes
Statspack
– needs to be set up
Customized Scripts
– Take time to write, no standards

Bit overkill for just a quick statistic rate query


Solution : Metrics
Rates are Automated in 10g

Deltas at set intervals


– 15 second
– 60 second
Current Rates
– per second
– per transaction
– Ratios and percentages
Which Statistics have Metrics?
Wait Events
– V$EVENTMETRIC (60 secs )
– V$WAITCLASSMETRIC (60 secs)

Statistics
– V$SESSMETRIC (15/60 secs)
– V$SYSMETRIC (15/60 secs)

Files
– V$FILEMETRIC ( 10 minutes)
Short Term History:
What happened in the Past?

v$sysstat
physical reads
Low rate
Little IO

High rate
Lots of IO
Solution: Metric History Tables
Last 60 minutes of history

v$sysstat
physical reads delta
delta
delta

delta

delta

delta

delta

60 secs 60 secs 60 secs 60 secs 60 secs 60 secs 60 secs


Metric History Tables
In memory

Statistics
– V$SYSMETRIC_HISTORY (15 and 60 seconds)

File IO
– V$FILEMETRIC_HISTORY (10 minutes)

Waits
– V$WAITCLASSMETRIC_HISTORY ( 60 seconds)
More Detail for Last 3 minutes

v$sysstat
physical reads delta
delta
delta

delta

delta

delta

delta

60 secs 60 secs 60 secs 60 secs 60 secs 60 secs 60 secs


Statistics have 15 sec deltas

v$sysstat
physical reads

3 Minutes
15 second deltas
v$sysmetric_history

3 minutes of 15 second deltas

60 minutes of 1 minute deltas

Not saved to disk but summary is


Long Term History, 7 days
On Disk

Statistics
– DBA_HIST_SYSMETRIC_SUMMARY
– DBA_HIST_SYSSTAT (cumulative)
– DBA_HIST_SYSMETRIC_HISTORY (alerts)

Waits
– WAITCLASSMETRIC_HISTORY (alerts)
– DBA_HIST_SYSTEM_EVENT (cumulative)

File IO

DBA_HIST_FILEMETRIC_HISTORY (alerts)
– DBA_HIST_FILESTATXS (cumulative)
EM Exposing Metrics
In Resume: Statistics

• Raw : v$sysstat
• Now : v$sysmetric
• 1 Hour : v$sysmetric_history (in memory)
• 7 Days : dba_hist_sysmetric_summary (with AWR)
There is also v$sessmetric
Exposed in EM
Session Metrics 15 Ses
V$sessmetric
BEGIN_TIME
END_TIME
INTSIZE_CSEC
SESSION_ID
SESSION_SERIAL_NUM
CPU
PHYSICAL_READS
PGA_MEMORY
HARD_PARSES
SOFT_PARSES
PHYSICAL_READ_PCT
LOGICAL_READ_PCT
Sysmetric 15 Secs
Per Sec and Per Transaction
Buffer Cache Hit Ratio Physical Reads
Memory Sorts Ratio Physical Writes
Execute Without Parse Physical Reads Direct
Ratio Redo Generated
Logons
Soft Parse Ratio
User Calls
Database CPU Time Logical Reads
Ratio
Redo Writes
Library Cache Hit Ratio Total Table Scans
Shared Pool Free % Full Index Scans
Txns Per Logon DB Block Gets
Consistent Read Gets
Per Sec DB Block Changes
Consistent Read Changes
User Transaction Per Sec
Executions
Sysmetric 60 Sec
Buffer Cache Hit Ratio Current Logons Count
Memory Sorts Ratio Current Open Cursors Count
Redo Allocation Hit Ratio User Limit %
User Commits Percentage SQL Service Response Time
User Rollbacks Percentage Database Wait Time Ratio
Cursor Cache Hit Ratio Database CPU Time Ratio
Rows Per Sort Row Cache Hit Ratio
Execute Without Parse Ratio Row Cache Miss Ratio
Soft Parse Ratio Library Cache Hit Ratio
User Calls Ratio Library Cache Miss Ratio
Global Cache Average CR Get Time Shared Pool Free %
Global Cache Average Current Get Time PGA Cache Hit %
Global Cache Blocks Corrupted Process Limit %
Global Cache Blocks Lost Session Limit %
Txns Per Logon
Sysmetric 60 Sec rates sec/txn
Per Second and Transaction
Per Sec Physical Reads Disk Sort
Physical Writes Enqueue Timeouts
User Commits Physical Reads Direct Enqueue Waits
User Rollbacks Physical Writes Direct Enqueue Deadlocks
User Transaction Physical Reads Direct Lobs Enqueue Requests
Physical Writes Direct Lobs DB Block Gets
DBWR Checkpoints
Redo Generated Consistent Read Gets
Background Checkpoints
Logons DB Block Changes
Network Traffic Volume Open Cursors Consistent Read Changes
User Calls CPU Usage
Per Transaction Recursive Calls CR Blocks Created
Logical Reads CR Undo Records Applied
Response Time Redo Writes User Rollback Undo Records Applied
Long Table Scans Leaf Node Splits
Total Table Scans Branch Node Splits
Full Index Scans PX downgraded 1 to 25%
Total Index Scans PX downgraded 25 to 50%
Total Parse Count PX downgraded 50 to 75%
Hard Parse Count PX downgraded 75 to 99%
Parse Failure Count .
Stats – ER
v$sysmetric Statistics Metrics
BEGIN_TIME
END_TIME
INTSIZE_CSEC
GROUP_ID
METRIC_ID v$metricgroup
METRIC_NAME GROUP_ID
VALUE
METRIC_UNIT NAME
v$sysstat
INTERVAL_SIZE STATISTIC#
v$sysmetric_history MAX_INTERVAL
v$sessmetric
NAME
CLASS
BEGIN_TIME VALUE
BEGIN_TIME HASH
END_TIME
END_TIME
INTSIZE_CSEC
INTSIZE_CSEC
GROUP_ID
SESSION_ID
METRIC_ID
SESSION_SERIAL_NUM
METRIC_NAME
CPU
VALUE
PHYSICAL_READS
METRIC_UNIT
PGA_MEMORY v$sessstat
HARD_PARSES STATISTIC#
v$sysmetric_summary SOFT_PARSES
NAME
BEGIN_TIME CLASS
END_TIME PHYSICAL_READ_PCT VALUE
INTSIZE_CSEC -> intsize
GROUP_ID
v$metricname LOGICAL_READ_PCT
HASH
GROUP_ID
METRIC_ID
GROUP_NAME
METRIC_NAME
METRIC_ID
NUM_INTERVAL
METRIC_NAME
MAXVAL
METRIC_UNIT
MINVAL
AVERAGE
STANDARD_DEVIATION
METRIC_UNIT
In Resume: Waits

• Raw : v$system_event
• Now : v$eventmetric (60 seconds)
• 1 Hour : -----
• 7 Days : dba_hist_system_event (cumulative)
In Resume: Files

• Raw : v$fileio
• Now : v$filemetric ( 10 Minutes)
• 1 Hour : v$filemetric_history ( 1 hour, 7 points)
• 7 Days : dba_hist_filemetric_history (alerts only)
System Statistics View
Stats ( V$stat_name) Waits ( V$event_name ) Files

Raw V$sysstat v$system_event v$fileio


v$event_histogram
v$system_wait_class

Now V$sysmetric v$eventmetric v$filemetric


v$waitclassmetric
v$metricgroup
v$metricname

V$sysmetric_history v$waitclassmetric_history v$filemetric_history


V$sysmetric_summary
1 Hour

7 days SYSMETRIC_SUMMARY SYSTEM_EVENT(cumulative) FILESTATXS (cumulative)


SYSSTAT (cumulative) WAITCLASSMETRIC_HISTORY (alert) TEMPSTATXS (cumulative)
DBA_HIST_* SYSMETRIC_HISTORY (alerts) FILEMETRIC_HISTORY (alert)
Metrics Summary
Current rates are easy and efficient
Last hour quickly accessible
History kept for a week
Metrics
 V$METRICGROUP
 V$METRICNAME
V$METRIC
 V$SYSMETRIC
V$METRIC_HISTORY
 V$SESSMETRIC
 V$FILEMETRIC
 V$EVENTMETRIC Combined view onto the other
 V$WAITCLASSMETRIC metric tables
 V$SVCMETRIC

 V$SYSMETRIC_HISTORY
 V$FILEMETRIC_HISTORY
 V$WAITCLASSMETRIC_HISTORY
 V$SVCMETRIC_HISTORY

 V$SYSMETRIC_SUMMARY
Wait Classes
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
Wait Classes
Administrative (39) Configuration (20)
– log file size
– switch logfile
– Enqueues: ST, HW, ITL
– rebuild index – Latch: redo copy,shared pool

Application (11) Idle (56)


– enqueues
– sqlnet break/reset
Network (25)
Cluster (113)
System I/O (19)
Commit (1)
– Log file Sync Scheduler (6)
Concurrency (12) User I/O (12)
– Latches: cbc, lbc,


Lib cache locks
Buffer busy wait
Other (485)
Wait Classes in EM
Wait Class Tables
v$system_wait_class
– cumulative

v$waitclassmetric
– Current rates

v$waitclassmetric_history
– Hour of rates (60 second intervals)
Waits Metrics
Cumulative Current deltas Last Hour Last 7 days
Wait
v$system_wait_class
Classes v$waitclassmetric v$waitclassmetric_history dba_hist_
WAIT_CLASS_ID
BEGIN_TIME BEGIN_TIME waitclassmetric_history
WAIT_CLASS# END_TIME
END_TIME
WAIT_CLASS
INTSIZE_CSEC INTSIZE_CSEC Only gets populated with alerts
TOTAL_WAITS WAIT_CLASS_ID
WAIT_CLASS_ID
TIME_WAITED WAIT_CLASS#
WAIT_CLASS#
NUM_SESS_WAITING NUM_SESS_WAITING
v$event_name TIME_WAITED TIME_WAITED
EVENT# WAIT_COUNT WAIT_COUNT
EVENT_ID
NAME
PARAMETER1
PARAMETER2
PARAMETER3
WAIT_CLASS_ID
WAIT_CLASS#
WAIT_CLASS

Wait Events
v$system_event v$eventmetric dba_hist_system_event
BEGIN_TIME
EVENT END_TIME
INTSIZE_CSEC
(Cumulative)
TOTAL_WAITS
TOTAL_TIMEOUTS EVENT_ID No in memory history
NUM_SESS_WAITING
TIME_WAITED
TIME_WAITED
AVERAGE_WAIT WAIT_COUNT
TIME_WAITED_MICRO
EVENT_ID
Time Model
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
Time Model
New concept
• DB Time

Total time for all database calls


• cpu time
• wait time
Time Model areas
Total Time
CPU
Elapsed Time
SQL execution
Plsql execution
Java execution
Connection time
Time Model Components
1) background elapsed time
2) background cpu time

1) DB time
2) DB CPU
2) connection management call elapsed time
2) sequence load elapsed time
2) sql execute elapsed time
2) parse time elapsed
3) hard parse elapsed time
4) hard parse (sharing criteria) elapsed time
5) hard parse (bind mismatch) elapsed time
3) failed parse elapsed time
4) failed parse (out of shared memory) elapsed time
2) PL/SQL execution elapsed time
2) inbound PL/SQL rpc elapsed time
2) PL/SQL compilation elapsed time
2) Java execution elapsed time
Total Time

Total Database
Time
Total and CPU

=~ DB Wait
Time
DB CPU
Time
Total and CPU and Parse Time

DB Wait DB CPU
Time Time

Parse
Elapsed
Time
Parse Time

Parse
Elapsed
Time
Hard Parse

hard
parse
elapse
Parse d time
time
elapsed
Hard Parse Sharing Criteria

hard
parse
(sharing
criteria)
Parse hard elapsed
time parse time
elapsed elapse
d time
Hard Parse Bind Mismatch

hard
parse
(bind
mismat
hard ch)
parse elapsed
Parse hard (sharing time
time parse criteria)
elapsed elapse elapsed
d time time
Time Model Tables
Current cumulative values
 V$SYS_TIME_MODEL
 V$SESS_TIME_MODEL

AWR Snapshots of cumulative values


 DBA_HIST_SYS_TIME_MODEL
ASH
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
ASH
Active Session History
History of v$session_wait
Every Second
All Active sessions
– In a database call, either
• CPU
• Wait
• Between 1M & 128M
• Flushed every 30 minutes or when buffer is full
ASH Fields
SQL> v$active_session_history

SAMPLE_ID/SAMPLE_TIME Name Null?


----------------------------------------- --------
Type
----------------------------
SAMPLE_ID NUMBER
EVENT SAMPLE_TIME TIMESTAMP(3)
SESSION_ID NUMBER
SESSION_STATE SESSION_SERIAL# NUMBER
USER_ID NUMBER
SESSION_ID SQL_ID
SQL_CHILD_NUMBER
VARCHAR2(13)
NUMBER

USER_ID SQL_PLAN_HASH_VALUE
SQL_OPCODE
NUMBER
NUMBER
SERVICE_HASH NUMBER
SQL_ID SESSION_TYPE VARCHAR2(10)
SESSION_STATE VARCHAR2(7)
SERVICE_HASH QC_SESSION_ID NUMBER
QC_INSTANCE_ID NUMBER
CURRENT_OBJ# EVENT
EVENT_ID
VARCHAR2(64)
NUMBER

CURRENT_FILE# EVENT#
SEQ#
NUMBER
NUMBER
P1 NUMBER
CURRENT_BLOCK# P2 NUMBER
P3 NUMBER
PROGRAM WAIT_TIME NUMBER
TIME_WAITED NUMBER
MODULE CURRENT_OBJ#
CURRENT_FILE#
NUMBER
NUMBER

ACTION CURRENT_BLOCK#
PROGRAM
NUMBER
VARCHAR2(48)
MODULE VARCHAR2(48)
CLIENT_ID ACTION VARCHAR2(32)
CLIENT_ID VARCHAR2(64)
Ash Group bys
Select sid, count(*) from v$active_session_history
where state=‘CPU’ and SAMPLE_TIME between sysdate
ad sysdate – (5/24*60) group by sid;
Select sid, event, count(*) from
v$active_session_history where state=‘WAIT’ and
SAMPLE_TIME between sysdate ad sysdate – (5/24*60)
group by sid, event;
Wait Time vs Time Waited
SESSION_STATE
– Waiting, on CPU
– Based on WAIT_TIME
WAIT_TIME
– 0 => waiting
– >0 => CPU (value is time of last wait)
TIME_WAITED
– Actual time waited for event
– 0 until wait finishes
– Fix up values (no one else can do this)
Session Polling View : ASH
stats
V$ V$session_wait

Metrics

30 Minutes * V$active_session_history *
Polling at 1 second
*extremely
(V$session_wait_history)
variable
AWR Wrh$_active_session_history
(1 in 10 values from “”) *
ASH ER
current 10 samples Half hour 7 days (disk)
v$session_wait v$session_wait_history v$active_session_history wrh$active_session_history
SID SID SNAP_D
SAMPLE_ID
SEQ# SEQ#
SAMPLE_TIME DBID
EVENT EVENT# INSTANCE_NUMBER
SESSION_ID
P1TEXT EVENT SAMPLE_ID
P1 P1TEXT SESSION_SERIAL#
SAMPLE_TIME
P1RAW P1 USER_ID
P2TEXT SESSION_ID
P2TEXT SQL_ID
P2 P2 SESSION_SERIAL#
SQL_CHILD_NUMBER
P2RAW USER_ID
P3TEXT
P3TEXT SQL_PLAN_HASH_VALUE
P3 SQL_ID
P3 SQL_OPCODE
WAIT_TIME SQL_CHILD_NUMBER
P3RAW
SERVICE_HASH
WAIT_CLASS_ID SQL_PLAN_HASH_VALUE
SESSION_TYPE
WAIT_CLASS# SQL_OPCODE
WAIT_CLASS SESSION_STATE
SERVICE_HASH
WAIT_TIME QC_SESSION_ID
SECONDS_IN_WAIT SESSION_TYPE
QC_INSTANCE_ID
STATE SESSION_STATE
SEQ#
QC_SESSION_ID
EVENT#
v$event_name P1
QC_INSTANCE_ID
SEQ#
EVENT_ID P2
EVENT_ID
EVENT# P3
P1
EVENT_ID WAIT_TIME
P2
NAME TIME_WAITED
P3
PARAMETER1 CURRENT_OBJ#
WAIT_TIME
PARAMETER2 CURRENT_FILE#
TIME_WAITED
PARAMETER3 CURRENT_BLOCK#
CURRENT_OBJ#
WAIT_CLASS_ID PROGRAM
CURRENT_FILE#
WAIT_CLASS# MODULE
CURRENT_BLOCK#
WAIT_CLASS ACTION
PROGRAM
CLIENT_ID
MODULE
ASH in Wait Drilldown
AWR
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
Automatic Workload Repository
Statspack on Steroids
More efficient than Statspack
Keeps stats every hour
Stores by default the last 7 days
Snapshoting

BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
END;
/
DBA_HIST
DBA_HIST_DATABASE_INSTANCE
DBA_HIST_RESOURCE_LIMIT
DBA_HIST_SNAPSHOT
DBA_HIST_SHARED_POOL_ADVICE
- DBA_HIST_SNAP_ERROR
?DBA_HIST_SQL_WORKAREA_HSTGRM
- DBA_HIST_BASELINE
DBA_HIST_PGA_TARGET_ADVICE
- DBA_HIST_WR_CONTROL ? (work load repository ?)
DBA_HIST_INSTANCE_RECOVERY
- DBA_HIST_DATAFILE
DBA_HIST_JAVA_POOL_ADVICE
DBA_HIST_FILESTATXS – only file number, no name
DBA_HIST_THREAD - logswitches
- DBA_HIST_TEMPFILE
-DBA_HIST_STAT_NAME
DBA_HIST_TEMPSTATXS – onl;y file number
DBA_HIST_SYSSTAT
+DBA_HIST_SQLSTAT group by parent cursor plus DELTAs was (stats$sql_summary)
-DBA_HIST_SYS_TIME_MODEL
DBA_HIST_SQLTEXT
-DBA_HIST_OSSTAT_NAME
+DBA_HIST_SQL_SUMMARY – identify litterals (was stat$sql_statistics)
-DBA_HIST_OSSTAT
DBA_HIST_SQL_PLAN
DBA_HIST_PARAMETER_NAME
-DBA_HIST_SQLBIND
DBA_HIST_PARAMETER
-DBA_HIST_OPTIMIZER_ENV
DBA_HIST_UNDOSTAT
-DBA_HIST_EVENT_NAME
DBA_HIST_ROLLSTAT
DBA_HIST_SYSTEM_EVENT
DBA_HIST_SEG_STAT
DBA_HIST_BG_EVENT_SUMMARY – sum of backgrounds
DBA_HIST_SEG_STAT_OBJ
DBA_HIST_WAITSTAT
-DBA_HIST_METRIC_NAME
DBA_HIST_ENQUEUE_STAT
-DBA_HIST_SYSMETRIC_HISTORY alert
-DBA_HIST_LATCH_NAME
-DBA_HIST_SYSMETRIC_SUMMARY – max, min, avg standard deviation
DBA_HIST_LATCH
-DBA_HIST_SESSMETRIC_HISTORY alert
DBA_HIST_LATCH_CHILDREN
-DBA_HIST_FILEMETRIC_HISTORY alert
DBA_HIST_LATCH_PARENT
-DBA_HIST_WAITCLASSMET_HISTORY alert
DBA_HIST_LATCH_MISSES_SUMMARY – summed over parent latch
DBA_HIST_DLM_MISC
DBA_HIST_LIBRARYCACHE
-DBA_HIST_RCVRY_FILE_DEST_STAT
DBA_HIST_DB_CACHE_ADVICE
-DBA_HIST_RMAN_PERFORMANCE
DBA_HIST_BUFFER_POOL_STAT
-DBA_HIST_ACTIVE_SESS_HISTORY – every 10th point from v$active_ses
DBA_HIST_ROWCACHE_SUMMARY – summed over rowcache entries
-DBA_HIST_TABLESPACE_STAT
DBA_HIST_SGA
-DBA_HIST_LOG
DBA_HIST_SGASTAT
DBA_HIST_MTTR_TARGET_ADVICE
DBA_HIST_PGASTAT
-DBA_HIST_TBSPC_SPACE_USAGE - ?
New in 10g
ADDM
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
Automatic Database Diagnostic Monitor
Every Hour with AWR
Analyze
Identify problems
Proposes solutions
ADDM Page
ADDM Details
ADDM Advice
ADDM
dba_advisor_findings TASK_NAME, TASK_ID (is indexed)
dba_advisor_recommendations TASK_ID,FINDING_ID
dba_advisor_actions TASK_ID and REC_ID

dba_advisor_rationale TASK_ID and REC_ID

dba_advisor_objects TASK_ID , OBJECT_ID from actions or rationale.


ADDM tables Add Free lists or
move to ASSM

Actions
BBW:
Read & write contention
on a block
Segment Tuning Tables
Findings objects
Recommendations

Rational

SQL
objects
ADDM tables
Types: Could be just a
message w/o
Application Analysis
command or
Types: DB Configuration rational
Actions
PROBLEM Host Configuration
Like investigate
SYMPTOM SQL Tuning application logic
INFORMATION Segment Tuning
Schema
Findings
Recommendations

Rational
Doesn’t
use type
ADDM does not
use this
connection
(maybe SQL
Tuning
Advisor )
22 types of which ADDM uses 7:
objects SQL
DATABASE OBJECT (Tables, Indexes, ...)
TABLESPACE
DATABASE BLOCK
DATABASE FILE
DATABASE LATCH
DATABASE ENQ
Miscellaneous
1. Metrics Part I

2. Wait Classes
3. Time Model
4. ASH Part II

5. AWR ( DBA_HIST_ )
6. ADDM
7. Misc Part III
Miscellaneous
Field naming conventions
Wait Improvements
– Wait histograms
– Waits in v$session and v$sql
– Waits broken out for latches and locks
– Waits show the blocker
– Wait history of last 10 waits
Services
Client Id
Fields Names
 Names
– Event
– Statistic
– Waitclass
 Ids
– Event#
– Statistic#
– Waitclass#
 Name Hash
– Event_id
– Statistic_id
– Waitclass_id
Wait Histograms
V$event_histogram
1ms to 1 hour buckets
23 buckets
< 1 ms, < 2 ms, < 4 ms, < 8 ms, ..., < 2^22 ms
Waits in v$session and v$sql
 V$session exposes all the fields from v$session_wait
SEQ# NUMBER
EVENT# NUMBER
EVENT VARCHAR2(64)
P1TEXT VARCHAR2(64)
P1 NUMBER
P1RAW RAW(4)
P2TEXT VARCHAR2(64)
P2 NUMBER
P2RAW RAW(4)
P3TEXT VARCHAR2(64)
P3 NUMBER
P3RAW RAW(4)
WAIT_CLASS_ID NUMBER
WAIT_CLASS# NUMBER
WAIT_CLASS VARCHAR2(64)
WAIT_TIME NUMBER
SECONDS_IN_WAIT NUMBER
STATE VARCHAR2(19)
V$SQL
 SQL_FULLTEXT
 SQL_ID
 FETCHES
 END_OF_FETCH_COUNT
 DIRECT_WRITES
 APPLICATION_WAIT_TIME
 CONCURRENCY_WAIT_TIME
 CLUSTER_WAIT_TIME
 USER_IO_WAIT_TIME
 PLSQL_EXEC_TIME
 JAVA_EXEC_TIME
 CPU_TIME
 ELAPSED_TIME
Wait Types Broken Out
800 waits
Latches broken out
– Ex) Latch: library cache latch
Enqueues broken out
– Ex) Enq: HW - contention
Waits show Blocking Session
V$session. BLOCKING_SESSION -> can build a
wait tree:
Waits History of last 10 waits
 select sid, event, p1,p2,p3 from v$session_wait_history
SID EVENT P1 P2 P3
---------- --------------------------- ---------- ---------- ----------
36 db file sequential read 1 953 1
36 SQL*Net message from client 1413697536 1 0
36 SQL*Net message from client 1413697536 1 0
36 SQL*Net message to client 1413697536 1 0
36 db file sequential read 1 658 1
36 db file sequential read 1 828 1
36 db file sequential read 1 569 1
36 db file sequential read 1 827 1
36 db file sequential read 1 19199 1
36 db file sequential read 1 29 1
Services
Services is a new way to measure resource usage
and statistics. A session is associated with a services
when the session connects to the database via the
listener.
Client Id
 Setting Client ID
dbms_session.set_identifier
(client_id);
 Enabling trace for a client ID
dbms_monitor.client_id_trace_enable
(client_id, TRUE, FALSE);
 Enabling statistics aggregation by client id
dbms_monitor.client_id_stat_enable
(client_id);
• Script to Extract Client Trace
trcsess
Session Dedicated
Scott John Sue Mike Randy Tim Mary

Oracle
S1 S2 S3 S4 S4 S5 S6
Sessions
Oracle Database Host
Session Dedicated trace
Scott John Sue Mike Randy Tim Mary

SQL_TRACE=TRUE

Oracle
S1 S2 S3 S4 S4 S5 S6
Sessions
Oracle Database Host
Session Pooling
Scott John Sue Mike Randy Tim Mary

Set client_id =
SCOTT
APP
Server
1

Oracle
S1 S2 S3 S4 S4 S5 S6 S7
Sessions
Oracle Database Host dbms_monitor.client_id_trace_enable
(client_id, TRUE, FALSE);
Session Pooling trace
Scott John Sue Mike Randy Tim Mary

APP
Server
1
S1, sql_trace=true

Oracle
S1 S2 S3 S4 S4 S5 S6 S7
Sessions
Oracle Database Host
Session Pooling multi app serv
Scott John Sue Mike Randy Tim Mary

APP APP APP


Server Server Server
1 2 3

Oracle
S1 S2 S3 S4 S4 S5 S6 S7
Sessions
Oracle Database Host
------ Reference -------------
System Statistics View
Stats ( V$stat_name) Waits ( V$event_name ) Time Model sql

Raw V$sysstat v$system_event v$sys_time_model V$sql


v$event_histogram
v$system_wait_class

Now V$sysmetric v$eventmetric


v$waitclassmetric Some goes into ASH
sysmetric x$kewrtsqlstat

V$sysmetric_history
V$sysmetric_summary v$waitclassmetric_history ASH
1 Hour

SYSMETRIC_SUMMARY SYSTEM_EVENT SYS_TIME_MODEL SQLSTAT


7 days SYSSTAT (cumulative) (cumulative)
(cumulative) WAITCLASSMETRIC_HISTORY
DBA_HIST_* SYSMETRIC_HISTORY (alert)
(alerts)
Session Statistics View
stats waits waitclasses Time Model sql

V$ V$sessstat V$session_event ---------------- V$sess_time_model -----------------


* (some stats
possible
from ASH)
Metrics V$sessmetric ----------------- ----------------- ----------------- -----------------

Metrics ----------------- ----------------- ----------------- ----------------- -----------------


history

AWR WRH$_SESSMET ----------------- ---------------- ----------------- -----------------


RIC_HISTORY * (some stats (some stats
(alert only) possible from possible
ASH) from ASH)
V$metric

v$metric
BEGIN_TIME
END_TIME
INTSIZE_CSEC
GROUP_ID
ENTITY_ID – session id, wait_class_id, etc
ENTITY_SEQUENCE
METRIC_ID
METRIC_NAME
VALUE
METRIC_UNIT
ASH

ASH provides two x$ fixed tables

x$kewash - returns a row for every ASH sample taken


x$ash- returns a row for every active session in every ASH sample

SELECT /*+ no_merge ordered use_nl(s,a) */ a.inst_id, a.sample_id, a.sample_tim


e, a.session_id, a.session_serial#, a.user_id, a.sql_id, a.sql_child_number,
a.sql_plan_hash_value, a.sql_opcode, a.service_hash, decode(a.session_type, 1,'FORE
GROUND', 2,'BACKGROUND', 'UNKNOWN'), decode(a.wait_time, 0, 'WAITING', 'ON CPU')
, a.qc_session_id, a.qc_instance_id, a.seq#, a.event#, a.p1, a.p2, a.p3, a.wait_
time, a.time_waited, a.current_obj#, a.current_file#, a.current_block#, a.progra
m, a.module, a.action, a.client_id FROM x$kewash s, x$ash a WHERE s.sample_addr
= a.sample_addr and s.sample_id = a.sample_id

No range scans on x$ tables, so full scan x$kewash and then use equality in query on x$ash
X$ Desc x$ash
desc x$ash
SQL> desc x$kewash ADDR RAW(4)
ADDR RAW(4) INDX NUMBER
INST_ID NUMBER
INDX NUMBER SAMPLE_ADDR NUMBER
INST_ID NUMBER SAMPLE_ID NUMBER
SAMPLE_TIME TIMESTAMP(3)
SAMPLE_ID NUMBER SESSION_ID NUMBER
SAMPLE_TIME TIMESTAMP(3) SESSION_SERIAL# NUMBER
USER_ID NUMBER
SAMPLE_ADDR NUMBER SQL_ID VARCHAR2(13)
SAMPLE_LENGTH NUMBER SQL_CHILD_NUMBER NUMBER
SQL_PLAN_HASH_VALUE NUMBER
ROW_COUNT NUMBER SERVICE_HASH NUMBER
SESSION_TYPE NUMBER
SQL_OPCODE NUMBER
QC_SESSION_ID NUMBER
QC_INSTANCE_ID NUMBER
CURRENT_OBJ# NUMBER
CURRENT_FILE# NUMBER
CURRENT_BLOCK# NUMBER
SEQ# NUMBER
EVENT# NUMBER
P1 NUMBER
P2 NUMBER
P3 NUMBER
WAIT_TIME NUMBER
TIME_WAITED NUMBER
PROGRAM VARCHAR2(48)
MODULE VARCHAR2(48)
ACTION VARCHAR2(32)
CLIENT_ID VARCHAR2(64)
Sql metrics: x$kewrtsqlstat
x$kewrtsqlstat

You might also like