Download presentation
Presentation is loading. Please wait.
Published byGeorgia Anthony Modified over 9 years ago
1
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
2
Performance Tuning in Oracle 10g Kyle Hailey
3
EM Product Layout for Performance Database Home Page Database Performance Page Drilldowns SQL Session
4
EM Pages Layout Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details
5
Buffer Busy Waits Use Case
6
Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details Three Paths
7
ADDM Path Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details
8
Database Home Page
9
ADDM Home Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details
10
ADDM Home
11
ADDM Details Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details
13
Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details Manual Path
14
Database Home Page
17
Performance Page Home Page Perf Page Top Session Top SQL Wait Detail SQL Detail Session Detail ADDM ADDM Details
18
Database Performance Page
19
Database Performance Page highlight
20
Wait Drill Down Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details
21
Wait Drill Down
24
Wait Drill Down highlight
25
Wait Drill Down – Top SQL
26
SQL Details Home Page Perf Page Top Session Wait Detail Top SQL SQL Detail Session Detail ADDM ADDM Details
27
SQL Details
28
New Features Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
29
Metrics Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
30
Metrics Motivation Performance Statistics Indicators of Database performance Cumulative Counters since DB Start Not Much use in raw form
31
Querying Statistics Select value from v$sysstat where name=‘physical reads’; SQL> / VALUE --------------- 1,533,787 SQL>
32
Statistics are Cumulative Statistics just keep growing v$sysstat physical reads
33
How many Physical Reads/Sec Statistics just keep growing v$sysstat physical reads What is the rate here? 1.5M
34
Low IO v$sysstat physical reads 1.5M IO’s time 30 minutes
35
High IO - same cumulative v$sysstat physical reads 1.5M IO’s time 30 minutes
36
Need Deltas to get Rates Take value at time A Take value at time B Rate = (B-A)/elapsed time
37
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
38
Solution : Metrics Rates are Automated in 10g Deltas at set intervals – 15 second – 60 second Current Rates – per second – per transaction – Ratios and percentages
39
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)
40
Short Term History: What happened in the Past? High rate Lots of IO Low rate Little IO v$sysstat physical reads
41
Solution: Metric History Tables Last 60 minutes of history v$sysstat physical reads 60 secs delta
42
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)
43
More Detail for Last 3 minutes v$sysstat physical reads 60 secs delta
44
Statistics have 15 sec deltas 3 Minutes 15 second deltas v$sysstat physical reads
45
v$sysmetric_history Not saved to disk but summary is 60 minutes of 1 minute deltas 3 minutes of 15 second deltas
46
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)
47
EM Exposing Metrics
48
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
49
Exposed in EM
50
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
51
Sysmetric 15 Secs Buffer Cache Hit Ratio Memory Sorts Ratio Execute Without Parse Ratio Soft Parse Ratio Database CPU Time Ratio Library Cache Hit Ratio Shared Pool Free % Txns Per Logon Physical Reads Physical Writes Physical Reads Direct Redo Generated Logons User Calls Logical Reads Redo Writes Total Table Scans Full Index Scans DB Block Gets Consistent Read Gets DB Block Changes Consistent Read Changes Executions User Transaction Per Sec Per Sec and Per Transaction Per Sec
52
Sysmetric 60 Sec Buffer Cache Hit Ratio Memory Sorts Ratio Redo Allocation Hit Ratio User Commits Percentage User Rollbacks Percentage Cursor Cache Hit Ratio Rows Per Sort Execute Without Parse Ratio Soft Parse Ratio User Calls Ratio Global Cache Average CR Get Time Global Cache Average Current Get Time Global Cache Blocks Corrupted Global Cache Blocks Lost Current Logons Count Current Open Cursors Count User Limit % SQL Service Response Time Database Wait Time Ratio Database CPU Time Ratio Row Cache Hit Ratio Row Cache Miss Ratio Library Cache Hit Ratio Library Cache Miss Ratio Shared Pool Free % PGA Cache Hit % Process Limit % Session Limit % Txns Per Logon
53
Sysmetric 60 Sec rates sec/txn Physical Reads Physical Writes Physical Reads Direct Physical Writes Direct Physical Reads Direct Lobs Physical Writes Direct Lobs Redo Generated Logons Open Cursors User Calls Recursive Calls Logical Reads Redo Writes Long Table Scans Total Table Scans Full Index Scans Total Index Scans Total Parse Count Hard Parse Count Parse Failure Count User Commits User Rollbacks User Transaction DBWR Checkpoints Background Checkpoints Network Traffic Volume Response Time Disk Sort Enqueue Timeouts Enqueue Waits Enqueue Deadlocks Enqueue Requests DB Block Gets Consistent Read Gets DB Block Changes Consistent Read Changes CPU Usage CR Blocks Created CR Undo Records Applied User Rollback Undo Records Applied Leaf Node Splits Branch Node Splits PX downgraded 1 to 25% PX downgraded 25 to 50% PX downgraded 50 to 75% PX downgraded 75 to 99%. Per Second and Transaction Per Sec Per Transaction
54
Statistics Metrics 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 v$metricname GROUP_ID GROUP_NAME METRIC_ID METRIC_NAME METRIC_UNIT v$sysmetric_summary BEGIN_TIME END_TIME INTSIZE_CSEC -> intsize GROUP_ID METRIC_ID METRIC_NAME NUM_INTERVAL MAXVAL MINVAL AVERAGE STANDARD_DEVIATION METRIC_UNIT v$sysmetric_history BEGIN_TIME END_TIME INTSIZE_CSEC GROUP_ID METRIC_ID METRIC_NAME VALUE METRIC_UNIT v$sysmetric BEGIN_TIME END_TIME INTSIZE_CSEC GROUP_ID METRIC_ID METRIC_NAME VALUE METRIC_UNIT v$sysstat STATISTIC# NAME CLASS VALUE HASH Stats – ER v$metricgroup GROUP_ID NAME INTERVAL_SIZE MAX_INTERVAL v$sessstat STATISTIC# NAME CLASS VALUE HASH
55
In Resume: Waits Raw : v$system_event Now : v$eventmetric (60 seconds) 1 Hour : ----- 7 Days : dba_hist_system_event (cumulative)
56
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)
57
System Statistics View Stats ( V$stat_name)Waits ( V$event_name )Files RawV$sysstatv$system_event v$event_histogram v$system_wait_class v$fileio Now v$metricgrou p v$metricname V$sysmetricv$eventmetric v$waitclassmetric v$filemetric 1 Hour V$sysmetric_history V$sysmetric_summary v$waitclassmetric_historyv$filemetric_history 7 days DBA_HIST_* SYSMETRIC_SUMMARY SYSSTAT (cumulative) SYSMETRIC_HISTORY (alerts) SYSTEM_EVENT(cumulative) WAITCLASSMETRIC_HISTORY (alert) FILESTATXS (cumulative) TEMPSTATXS (cumulative) FILEMETRIC_HISTORY (alert)
58
Metrics Summary Current rates are easy and efficient Last hour quickly accessible History kept for a week
59
Metrics V$METRICGROUP V$METRICNAME V$SYSMETRIC V$SESSMETRIC V$FILEMETRIC V$EVENTMETRIC V$WAITCLASSMETRIC V$SVCMETRIC V$SYSMETRIC_HISTORY V$FILEMETRIC_HISTORY V$WAITCLASSMETRIC_HISTORY V$SVCMETRIC_HISTORY V$SYSMETRIC_SUMMARY V$METRIC V$METRIC_HISTORY Combined view onto the other metric tables
60
Metric Group and v$metric 1* select * from v$metricgroup GID NAME INTS M_INT GROUP_ID COUNT(*) --- ----------------------------------- ------ ----- -------- ---------- 0 Event Metrics 6000 1 0 3 (per event) 1 Event Class Metrics 6000 60 1 4 (per waitclass) 2 System Metrics Long Duration 6000 60 2 114 3 System Metrics Short Duration 1500 12 3 40 4 Session Metrics Long Duration 6000 60 4 1 (blcoked user) 5 Session Metrics Short Duration 1500 1 5 8 (per session) 6 Service Metrics 6000 60 6 2 (per service) 7 File Metrics Long Duration 60000 6 7 6 (per file) 2 is a superset of 3 4 is a superset of 5 Ie, v$sysmetric_history keeps the last hour for long duration deltas, 60s, and the last 3 minutes for short duration, 15 second deltas Max Interval
61
Wait Classes Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
62
Wait Classes Administrative (39) – switch logfile – rebuild index Application (11) – enqueues – sqlnet break/reset Cluster (113) Commit (1) – Log file Sync Concurrency (12) – Latches: cbc, lbc, – Lib cache locks – Buffer busy wait Configuration (20) – log file size – Enqueues: ST, HW, ITL – Latch: redo copy,shared pool Idle (56) Network (25) System I/O (19) Scheduler (6) User I/O (12) Other (485)
63
Wait Classes in EM
64
Wait Class Tables v$system_wait_class – cumulative v$waitclassmetric – Current rates v$waitclassmetric_history – Hour of rates (60 second intervals)
65
v$waitclassmetric BEGIN_TIME END_TIME INTSIZE_CSEC WAIT_CLASS_ID WAIT_CLASS# NUM_SESS_WAITING TIME_WAITED WAIT_COUNT Waits Metrics v$waitclassmetric_history BEGIN_TIME END_TIME INTSIZE_CSEC WAIT_CLASS_ID WAIT_CLASS# NUM_SESS_WAITING TIME_WAITED WAIT_COUNT v$eventmetric BEGIN_TIME END_TIME INTSIZE_CSEC EVENT_ID NUM_SESS_WAITING TIME_WAITED WAIT_COUNT v$event_name EVENT# EVENT_ID NAME PARAMETER1 PARAMETER2 PARAMETER3 WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS v$system_wait_class WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS TOTAL_WAITS TIME_WAITED v$system_event EVENT TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT TIME_WAITED_MICRO EVENT_ID No in memory history dba_hist_system_event (Cumulative) dba_hist_ waitclassmetric_history Only gets populated with alerts Wait Classes Wait Events CumulativeCurrent deltasLast HourLast 7 days
66
Time Model Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
67
Time Model New concept DB Time Total time for all database calls cpu time wait time
68
Time Model areas Total Time CPU Elapsed Time SQL execution Plsql execution Java execution Connection time
69
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
70
Total Time Total Database Time
71
Total and CPU DB CPU Time =~ DB Wait Time
72
Total and CPU and Parse Time DB CPU Time DB Wait Time Parse Elapsed Time
73
Parse Time Parse Elapsed Time
74
Hard Parse Parse time elapsed hard parse elapse d time
75
Hard Parse Sharing Criteria Parse time elapsed hard parse elapse d time hard parse (sharing criteria) elapsed time
76
Hard Parse Bind Mismatch Parse time elapsed hard parse elapse d time hard parse (sharing criteria) elapsed time hard parse (bind mismat ch) elapsed time
77
Time Model Tables Current cumulative values V$SYS_TIME_MODEL V$SESS_TIME_MODEL AWR Snapshots of cumulative values DBA_HIST_SYS_TIME_MODEL
78
ASH Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
79
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
80
ASH Fields SQL> v$active_session_history Name Null? Type ----------------------------------------- -------- ---------------------------- SAMPLE_ID NUMBER SAMPLE_TIME TIMESTAMP(3) SESSION_ID NUMBER SESSION_SERIAL# NUMBER USER_ID NUMBER SQL_ID VARCHAR2(13) SQL_CHILD_NUMBER NUMBER SQL_PLAN_HASH_VALUE NUMBER SQL_OPCODE NUMBER SERVICE_HASH NUMBER SESSION_TYPE VARCHAR2(10) SESSION_STATE VARCHAR2(7) QC_SESSION_ID NUMBER QC_INSTANCE_ID NUMBER EVENT VARCHAR2(64) EVENT_ID NUMBER EVENT# NUMBER SEQ# NUMBER P1 NUMBER P2 NUMBER P3 NUMBER WAIT_TIME NUMBER TIME_WAITED NUMBER CURRENT_OBJ# NUMBER CURRENT_FILE# NUMBER CURRENT_BLOCK# NUMBER PROGRAM VARCHAR2(48) MODULE VARCHAR2(48) ACTION VARCHAR2(32) CLIENT_ID VARCHAR2(64) SAMPLE_ID/SAMPLE_TIME EVENT SESSION_STATE SESSION_ID USER_ID SQL_ID SERVICE_HASH CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# PROGRAM MODULE ACTION CLIENT_ID
81
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;
82
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)
83
Session Polling View : ASH stats V$V$session_wait Metrics 30 Minutes * *extremely variable V$active_session_history * Polling at 1 second (V$session_wait_history) AWRWrh$_active_session_history (1 in 10 values from “”) *
84
ASH ER v$session_wait SID SEQ# EVENT P1TEXT P1 P1RAW P2TEXT P2 P2RAW P3TEXT P3 P3RAW WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS WAIT_TIME SECONDS_IN_WAIT STATE v$session_wait_history SID SEQ# EVENT# EVENT P1TEXT P1 P2TEXT P2 P3TEXT P3 WAIT_TIME v$event_name EVENT_ID EVENT# EVENT_ID NAME PARAMETER1 PARAMETER2 PARAMETER3 WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS v$active_session_history SAMPLE_ID SAMPLE_TIME SESSION_ID SESSION_SERIAL# USER_ID SQL_ID SQL_CHILD_NUMBER SQL_PLAN_HASH_VALUE SQL_OPCODE SERVICE_HASH SESSION_TYPE SESSION_STATE QC_SESSION_ID QC_INSTANCE_ID SEQ# EVENT# P1 P2 P3 WAIT_TIME TIME_WAITED CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# PROGRAM MODULE ACTION CLIENT_ID current 10 samples Half hour wrh$active_session_history SNAP_D DBID INSTANCE_NUMBER SAMPLE_ID SAMPLE_TIME SESSION_ID SESSION_SERIAL# USER_ID SQL_ID SQL_CHILD_NUMBER SQL_PLAN_HASH_VALUE SQL_OPCODE SERVICE_HASH SESSION_TYPE SESSION_STATE QC_SESSION_ID QC_INSTANCE_ID SEQ# EVENT_ID P1 P2 P3 WAIT_TIME TIME_WAITED CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# PROGRAM MODULE ACTION CLIENT_ID 7 days (disk)
85
ASH in Wait Drilldown
86
AWR Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
87
Automatic Workload Repository Statspack on Steroids More efficient than Statspack Keeps stats every hour Stores by default the last 7 days
88
Snapshoting BEGIN DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT (); END; /
89
DBA_HIST DBA_HIST_DATABASE_INSTANCE DBA_HIST_SNAPSHOT - DBA_HIST_SNAP_ERROR - DBA_HIST_BASELINE - DBA_HIST_WR_CONTROL ? (work load repository ?) - DBA_HIST_DATAFILE DBA_HIST_FILESTATXS – only file number, no name - DBA_HIST_TEMPFILE DBA_HIST_TEMPSTATXS – onl;y file number +DBA_HIST_SQLSTAT group by parent cursor plus DELTAs was (stats$sql_summary) DBA_HIST_SQLTEXT +DBA_HIST_SQL_SUMMARY – identify litterals (was stat$sql_statistics) DBA_HIST_SQL_PLAN -DBA_HIST_SQLBIND -DBA_HIST_OPTIMIZER_ENV -DBA_HIST_EVENT_NAME DBA_HIST_SYSTEM_EVENT DBA_HIST_BG_EVENT_SUMMARY – sum of backgrounds DBA_HIST_WAITSTAT DBA_HIST_ENQUEUE_STAT -DBA_HIST_LATCH_NAME DBA_HIST_LATCH DBA_HIST_LATCH_CHILDREN DBA_HIST_LATCH_PARENT DBA_HIST_LATCH_MISSES_SUMMARY – summed over parent latch DBA_HIST_LIBRARYCACHE DBA_HIST_DB_CACHE_ADVICE DBA_HIST_BUFFER_POOL_STAT DBA_HIST_ROWCACHE_SUMMARY – summed over rowcache entries DBA_HIST_SGA DBA_HIST_SGASTAT DBA_HIST_PGASTAT DBA_HIST_RESOURCE_LIMIT DBA_HIST_SHARED_POOL_ADVICE ?DBA_HIST_SQL_WORKAREA_HSTGRM DBA_HIST_PGA_TARGET_ADVICE DBA_HIST_INSTANCE_RECOVERY DBA_HIST_JAVA_POOL_ADVICE DBA_HIST_THREAD - logswitches -DBA_HIST_STAT_NAME DBA_HIST_SYSSTAT -DBA_HIST_SYS_TIME_MODEL -DBA_HIST_OSSTAT_NAME -DBA_HIST_OSSTAT DBA_HIST_PARAMETER_NAME DBA_HIST_PARAMETER DBA_HIST_UNDOSTAT DBA_HIST_ROLLSTAT DBA_HIST_SEG_STAT DBA_HIST_SEG_STAT_OBJ -DBA_HIST_METRIC_NAME -DBA_HIST_SYSMETRIC_HISTORY alert -DBA_HIST_SYSMETRIC_SUMMARY – max, min, avg standard deviation -DBA_HIST_SESSMETRIC_HISTORY alert -DBA_HIST_FILEMETRIC_HISTORY alert -DBA_HIST_WAITCLASSMET_HISTORY alert DBA_HIST_DLM_MISC -DBA_HIST_RCVRY_FILE_DEST_STAT -DBA_HIST_RMAN_PERFORMANCE -DBA_HIST_ACTIVE_SESS_HISTORY – every 10 th point from v$active_session_history -DBA_HIST_TABLESPACE_STAT -DBA_HIST_LOG DBA_HIST_MTTR_TARGET_ADVICE -DBA_HIST_TBSPC_SPACE_USAGE - ? New in 10g
90
ADDM Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
91
Automatic Database Diagnostic Monitor Every Hour with AWR Analyze Identify problems Proposes solutions
92
ADDM Page
93
ADDM Details
94
ADDM Advice
95
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.
96
ADDM tables Actions Findings Recommendations objects Rational Add Free lists or move to ASSM SQL BBW: Read & write contention on a block Segment Tuning objects Tables
97
ADDM tables Actions Findings Recommendations objects Rational Could be just a message w/o command or rational Like investigate application logic 22 types of which ADDM uses 7: SQL DATABASE OBJECT (Tables, Indexes,...) TABLESPACE DATABASE BLOCK DATABASE FILE DATABASE LATCH DATABASE ENQ ADDM does not use this connection (maybe SQL Tuning Advisor ) Types: PROBLEM SYMPTOM INFORMATION Types: Application Analysis DB Configuration Host Configuration SQL Tuning Segment Tuning Schema Doesn’t use type
98
Miscellaneous Metrics Wait Classes Time Model ASH AWR ( DBA_HIST_ ) ADDM Misc Part I Part II Part III
99
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
100
Fields Names Names – Event – Statistic – Waitclass Ids – Event# – Statistic# – Waitclass# Name Hash – Event_id – Statistic_id – Waitclass_id
101
Wait Histograms V$event_histogram 1ms to 1 hour buckets 23 buckets < 1 ms, < 2 ms, < 4 ms, < 8 ms,..., < 2^22 ms
102
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)
103
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
104
Wait Types Broken Out 800 waits Latches broken out – Ex) Latch: library cache latch Enqueues broken out – Ex) Enq: HW - contention
105
Waits show Blocking Session V$session. BLOCKING_SESSION -> can build a wait tree:
106
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 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
107
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.
108
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
109
Session Dedicated Oracle Database Host Oracle Sessions S1 S2 S3 S4 S5 S6 Scott John Sue Mike Randy Tim Mary
110
Session Dedicated trace Oracle Database Host Oracle Sessions S1 S2 S3 S4 S5 S6 Scott John Sue Mike Randy Tim Mary SQL_TRACE=TRUE
111
Session Pooling Oracle Database Host APP Server 1 Oracle Sessions S1 S2 S3 S4 S5 S6 S7 Scott John Sue Mike Randy Tim Mary Set client_id = SCOTT dbms_monitor.client_id_trace_enable (client_id, TRUE, FALSE);
112
Session Pooling trace Oracle Database Host APP Server 1 Oracle Sessions S1 S2 S3 S4 S5 S6 S7 Scott John Sue Mike Randy Tim Mary S1, sql_trace=true
113
Session Pooling multi app serv Oracle Database Host APP Server 1 Oracle Sessions S1 S2 S3 S4 S5 S6 S7 Scott John Sue Mike Randy Tim Mary APP Server 2 APP Server 3
114
------ Reference -------------
115
System Statistics View Stats ( V$stat_name)Waits ( V$event_name )Time Modelsql RawV$sysstatv$system_event v$event_histogram v$system_wait_class v$sys_time_model V$sql NowV$sysmetricv$eventmetric v$waitclassmetricSome goes into sysmetric ASH x$kewrtsqlstat 1 Hour V$sysmetric_history V$sysmetric_summary v$waitclassmetric_historyASH 7 days DBA_HIST_* SYSMETRIC_SUMMARY SYSSTAT (cumulative) SYSMETRIC_HISTORY (alerts) SYSTEM_EVENT (cumulative) WAITCLASSMETRIC_HISTORY (alert) SYS_TIME_MODEL (cumulative) SQLSTAT
116
Session Statistics View statswaitswaitclassesTime Modelsql V$V$sessstatV$session_event----------------V$sess_time_model * ----------------- (some stats possible from ASH) MetricsV$sessmetric----------------- Metrics history ----------------- AWR WRH$_SESSMET RIC_HISTORY * (alert only) ----------------- (some stats possible from ASH) --------------------------------- (some stats possible from ASH)
117
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
118
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
119
X$ Desc x$ash SQL> desc x$kewash ADDR RAW(4) INDX NUMBER INST_ID NUMBER SAMPLE_ID NUMBER SAMPLE_TIME TIMESTAMP(3) SAMPLE_ADDR NUMBER SAMPLE_LENGTH NUMBER ROW_COUNT NUMBER desc x$ash ADDR RAW(4) INDX NUMBER INST_ID NUMBER SAMPLE_ADDR NUMBER SAMPLE_ID NUMBER SAMPLE_TIME TIMESTAMP(3) SESSION_ID NUMBER SESSION_SERIAL# NUMBER USER_ID NUMBER SQL_ID VARCHAR2(13) SQL_CHILD_NUMBER NUMBER SQL_PLAN_HASH_VALUE 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)
120
Sql metrics: x$kewrtsqlstat x$kewrtsqlstat
121
ASH init.ora Statistics_level=typical _active_session_history=true
122
ASH structure Select reads backwards Insert point x$ addr
123
ADDM tables dba_advisor_actions OWNER TASK_ID TASK_NAME REC_ID ACTION_ID OBJECT_ID COMMAND COMMAND_ID FLAGS ATTR1 ATTR2 ATTR3 ATTR4 ATTR5 ATTR6 NUM_ATTR1 NUM_ATTR2 NUM_ATTR3 NUM_ATTR4 NUM_ATTR5 MESSAGE dba_advisor_findings OWNER TASK_ID TASK_NAME FINDING_ID TYPE PARENT OBJECT_ID IMPACT_TYPE IMPACT MESSAGE MORE_INFO dba_advisor_recommendations OWNER REC_ID TASK_ID TASK_NAME FINDING_ID TYPE RANK PARENT_REC_IDS BENEFIT_TYPE BENEFIT ANNOTATION_STATUS dba_advisor_objects OWNER OBJECT_ID TYPE TYPE_ID TASK_ID TASK_NAME ATTR1 ATTR2 ATTR3 ATTR4 dba_advisor_rationale OWNER TASK_ID TASK_NAME REC_ID RATIONALE_ID IMPACT_TYPE IMPACT MESSAGE OBJECT_ID TYPE ATTR1 ATTR2 ATTR3 ATTR4 ATTR5
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.