awr and eyond deep dive, (dont forget · 5/1/2015  · title: how to use the powerpoint template...

85

Upload: others

Post on 07-Aug-2020

2 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30
Page 2: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR and Beyond Deep Dive, (Don’t Forget EM12c!)

Oracle Confidential 2

Kellyn Pot’Vin-Gorman, Consulting Member of Technical Team, Strategic Customer Program May, 2015

Page 3: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Safe Harbor Statement

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Page 4: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Page 5: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Stay on the Path…

• Optimization- Tune for Time or You’re Wasting Time.

• Know your goal(s)

• Set a stopping point, avoid OTD, (Obsessive Tuning Disorder)

• Do NOT assume. Always do the research and have data behind findings.

Page 6: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Brief History

• ASH= Active Session History

• AWR= Automatic Workload Repository

• Introduced in Oracle 10g

• Evolution to statspack, requests for performance reporting improvements.

• “Always on” approach to performance metrics with requirement of non-locking collection process.

• Requires Management Diagnostic Pack License from Oracle.

Page 7: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

The Location in EM12c For Some of Today’s Presentation…

Page 8: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Automatic Workload Repository, (AWR) Reports

• Always on with default intervals of 1hr snapshots and 8 days retention.

• Should have at least 60 days of retained data.

• Desire more? Have an AWR Warehouse.

• Interval increase? Use this during workload testing, otherwise, take a manual snapshot:

EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;

Page 9: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Page 10: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Reports Are Best Used For..

• To inspect a database level issues, for both a small window of time to extended window.

• Extensive information in report, knowing HOW to parse through the report to achieve goal is important.

• Via EM12c, the report is offered in HTML format and will be environment aware, (single instance, RAC, Exadata.)

• Different reports available from the command line when running from the $ORACLE_HOME/rdbms/admin directory and can be generated in HTML or TXT format.

Page 11: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Wasting Time….

Rarely is there value in this section. As long is everything contains high percentages, move on.

Page 12: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR- Top 10 Foreground

•CPU is expected and should be the majority of time. •CPU processing can be extensive though, (still needs to be investigated) •Anything under 10% commonly is disregarded. •Understand what each wait event definition is

Page 13: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top SQL

Focus on Elapsed Time, but… Displays Top SQL by: •CPU •IO •Gets •Reads, etc…

Page 14: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Full SQL Statements

Linked from Top SQL Lists in HTML report via SQL_ID links. Quick reference when needed.

Page 15: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SGA “Thrashing”

Page 16: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Why PGA is Important

What is an optimal vs. 1 or (M)ulti-pass executions?

Page 17: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Why Can’t I Achieve 100%??

You shall not pass! (90%, that is… )

Page 18: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Percentages and Amounts of Reads are Important

Top two objects correspond to SQL statements in the top IO and most likely top SQL by elapsed time.

Page 19: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

What is a Direct Physical Read?

•Inefficient SQL and objects that have high quantity of row changes involved. •Adds significant pressure in RAC environment, too!

Page 20: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Unoptimized vs. Optimized?

Percentages are very low, (under 10%, which is a good sign for this database!

Page 21: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Initial Transaction Locks

10% rule applies here, too! ALTER TABLE <name> initrans <xx>;

Page 22: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

RAC Interconnect Exchange

•Data from V$SYSMETRIC_HISTORY •High Exchange rate can signal and issue.

Page 23: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

RAC Cache Interconnect Stats

Page 24: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Transfer Rate Between RAC Nodes

Page 25: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ASH Reports

• Excellent for identifying specific issues in database.

• Identifies not just the top SQL, but code.

• Shows top wait events by sample time.

• Don’t confuse samples with AWR snapshots.

• Should not be used to track # of executions.

Page 26: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Page 27: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Running ASH Report from EM

• ASH is by time, not snapshot. • Set start date and time. • End date and time • Generate report

Page 28: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

HTML Format ASH

Page 29: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Main ASH Info

Page 30: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top SQL, Top Sessions

Page 31: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top SQL Details

Page 32: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Top Parallel, Top DB Files

Page 33: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ASH Report- Use Case @$ORACLE_HOME/rdbms/admin/ashrpt.sql; -Report Format: Text or HTML. -Timestamp to being report from. -Duration in minutes. -Name of report.

Page 34: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

“Interesting Part”

Page 35: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Finale!

Select * from table(dbms_xplan.display_awr(‘43mp3mjufgnkg’));

Page 36: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR and ASH from the CLI

All DBAs should know how to do this!

Page 37: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Running Reports, Command Line

$ORACLE_HOME/rdbms/admin/awrrpt.sql;

$ORACLE_HOME/rdbms/admin/ashrpt.sql;

$ORACLE_HOME/rdbms/admin/awrsqlrpt.sql; Less Known AWR Reports:

awrinfo.sql General AWR Info

awrddrpt.sql Comparison report between snapshots

awrblmig.sql Migrates pre-11g baseline data into 11g Baseline tables.

awrgrpt.sql RAC Aware AWR Report.

Page 38: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Info Report

• Snapshot Interval Information

• Basic Info on Instances and Nodes

• No User or Application Schema info.

• Space Usage by SYSAUX

• WRH$ and Non- AWR Objects, ordered by size

• Snapshot info and if any errors.

• Advisor Tasks

Page 39: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Info Report

Page 40: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ASH Info Report @$ORACLE_HOME/rdbms/admin/awrrpt.sql; -Report Format: Text or HTML -Days to view snapshot IDs -Beginning and Ending Snapshot ID’s - Name of Report

Page 41: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL_ID Specific AWR Report

Page 42: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Querying ASH Data Directly

• More defined reporting

• No need to pull full report

• Detail on waits that are of interest

• Join to non-AWR objects

• Examples and Ideas…

Page 43: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

V$ACTIVE_SESSION_HISTORY • SAMPLE_ID- This is a unique identifier within an ASH sample.

• SAMPLE_TIME- A unit of time used by Active Session History, (not to be confused with DB_TIME)

• USER_ID- Identifier for a user that’s executing the session.

• SESSION_ID- Same as the SID or Session ID and can be used to join to SID in other views/tables.

• SESSION_STATE- What was the state of the session when ASH recorded the sample.

• ON CPU/WAITING- The two session states in Active Session History. ON CPU is active, vs. Waiting, which is self-explanatory.

• EVENT- Type of event that the session is currently active or waiting on.

• TIME_WAITED- How long the session has been waiting if waiting.

• WAIT_TIME- Confusing- but this is populated by any wait time if the session is currently active and for the previous waits.

• SQL_ID- The unique identifier for the SQL statement being executed.

• SQL_CHILD_NUMBER-The cursor child number.

Page 44: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Session Averages Select ROUND(RATIO_TO_REPORT(SUM(1)) OVER () * 100 ,2) PERCENTAGE,ash.session_type SESS_TYPE,

session_state STATUS, decode(nvl(sql_id,'-1'),'-1','nonsql','sql') SQL_TYPE,

count(distinct to_char(session_id)|| to_char(session_serial#)) SESS_CNT

from v$active_session_history ash

where

sample_time > sysdate - 30/(24*60) and (

( ash.session_state = 'ON CPU' )

or

( ash.session_type != 'BACKGROUND' ))

group by

ash.session_type,

ash.session_state, decode(nvl(sql_id,'-1'),'-1','nonsql','sql')

order by count(*)

/

Page 45: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Session Avg. Output

• Note the % of Background processes

Page 46: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Inspecting What select * from (select ash.SQL_ID , ash.SQL_PLAN_HASH_VALUE Plan_hash, aud.name type,

sum(decode(ash.session_state,'ON CPU',1,0)) "CPU",

sum(decode(ash.session_state,'WAITING',1,0)) "WAITING",

sum(decode(ash.session_state,'WAITING', decode(wait_class, 'User I/O',1,0),0)) "IO WAIT" ,

sum(decode(ash.session_state,'WAITING', decode(wait_class, 'User I/O',1,0),0)) "IO" ,

sum(decode(ash.session_state,'WAITING', decode(wait_class, 'Concurrency',1,0))) "CONCURRENCY" ,

sum(decode(ash.session_state,'WAITING', decode(wait_class, 'Application',1,0))) "Application" ,

sum(decode(ash.session_state,'ON CPU',1,1)) "TOTAL"

from v$active_session_history ash, audit_actions aud where SQL_ID is not NULL

and ash.sql_opcode=aud.action and ash.sample_time > sysdate - &minutes /( 60*24)

group by sql_id, SQL_PLAN_HASH_VALUE , aud.name

order by sum(decode(session_state,'ON CPU',1,1)) desc

) where rownum < 5;

Page 47: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

10 Min. View of Waits by SQL_ID

• Choose Time in Minutes To Review, (10 in our example)

• SQL_ID and Plan Hash Value Shown

• Waits for CPU, Wait, IO Wait and others.

Page 48: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Quantity of Events Occurred Over Small Amounts of Time

Col event for a50

select event, count(1)

from v$active_session_history

where sample_time between

to_date('21-FEB-14 01.43.00 PM','dd-MON-yy hh:mi:ss PM')

and

to_date('21-FEB-15 01.53.00 PM','dd-MON-yy hh:mi:ss PM')

group by event

order by event;

Page 49: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Results, Where to Focus?

Page 50: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Transaction Wait Detail select to_char(sample_time,'HH:MI') st, substr(event,0,20) event,

ash.session_id sid, mod(ash.p1,16) lm, ash.p2,

ash.p3, nvl(o.object_name,ash.current_obj#) objn,

substr(o.object_type,0,10) otype, CURRENT_FILE# fn,

CURRENT_BLOCK# blockn, ash.SQL_ID, BLOCKING_SESSION bsid

from v$active_session_history ash, all_objects o

where event like 'enq: TX%'

and o.object_id (+)= ash.CURRENT_OBJ#

and sample_time > sysdate - 10/(60*24)

order by sample_time;

Page 51: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Transaction Lock Output

• What TX row locks are occurring!

Page 52: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Knowing What’s in the ASH Buffer

• Deters from making assumptions on what data is being queried. • Know your samples!

Page 53: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Wait Events Across Nodes

Page 54: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Query top 10 SQL_ID’s in the last 10 minutes?

Page 55: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL_ID and CPU Usage

Page 56: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

IO Waits by Object from ASH

Page 57: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Text with ASH

• SQL for most recent five minutes of sample data from ASH

Page 58: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Results • SQL_ID, SQL Text, Sample Time that Process was captured in.

Page 59: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Average Activity- Graphed

Page 60: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Formatting and Setup accept hours prompt "hours (default 12) : " default 12

select &hours f_hours from dual;

select 3600 f_secs from dual;

select &v_secs f_samples from dual;

select 30 f_graph from dual;

select to_char(to_date(tday||' '||tmod*&v_secs,'YYMMDD SSSSS'),'DD-MON HH24:MI:SS') tm,

samples npts,total/&samples aas, substr(substr(substr(rpad('+',round((cpu*&v_bars)/&samples),'+') ||

rpad('-',round((waits*&v_bars)/&samples),'-') ||

rpad(' ',p.value * &v_bars,' '),0,(p.value * &v_bars)) ||

p.value || substr(rpad('+',round((cpu*&v_bars)/&samples),'+') ||

rpad('-',round((waits*&v_bars)/&samples),'-') ||

rpad(' ',p.value * &v_bars,' '),(p.value * &v_bars),10) ,0,30)

,0,&v_graph)graph,total,cpu, waits from (

Page 61: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

select to_char(sample_time,'YYMMDD')tday

, trunc(to_char(sample_time,'SSSSS')/&v_secs) tmod , sum(decode(session_state,'ON CPU',1,decode(session_type,'BACKGROUND',0,1))) total

, (max(sample_id) - min(sample_id) + 1 ) samples , sum(decode(session_state,'ON CPU' ,1,0)) cpu

, sum(decode(session_type,'BACKGROUND',0,decode(session_state,'WAITING',1,0))) waits

from v$active_session_history where sample_time > sysdate - &v_hours/24

group by trunc(to_char(sample_time,'SSSSS')/&v_secs), to_char(sample_time,'YYMMDD')

union all

select to_char(sample_time,'YYMMDD')tday, trunc(to_char(sample_time,'SSSSS')/&v_secs) tmod

, sum(decode(session_state,'ON CPU',10,decode(session_type,'BACKGROUND',0,10))) total

, (max(sample_id) - min(sample_id) + 1 ) samples, sum(decode(session_state,'ON CPU' ,10,0)) cpu

, sum(decode(session_type,'BACKGROUND',0,decode(session_state,'WAITING',10,0))) waits

from dba_hist_active_sess_history where sample_time > sysdate - &v_hours/24 and sample_time < (select min(sample_time) from v$active_session_history)

group by trunc(to_char(sample_time,'SSSSS')/&v_secs), to_char(sample_time,'YYMMDD')) ash, v$parameter p

where p.name='cpu_count'

order by to_date(tday||' '||tmod*&v_secs,'YYMMDD SSSSS');

Page 62: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Pivot the Wait Events

Page 63: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Digging into History

• DBA_HIST_ACTIVE_SESS_HISTORY

– SNAP_ID

– SAMPLE_ID

– SAMPLE_TIME

– SESSION_ID

– USER_ID

– SQL_ID

– WAIT_CLASS

– SESSION_STATE

– PGA_ALLOCATED

Page 64: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Process Information SELECT * FROM (

SELECT /*+ PARALLEL */

count(*) AS count,

user_id, program, module, sql_id

FROM SYS.DBA_HIST_ACTIVE_SESS_HISTORY

WHERE sample_time > TO_DATE('19-FEB-2014 03.00.00 PM','dd-MON-yy hh:mi:ss PM')

AND sample_time < TO_DATE('19-FEB-2014 08.00.00 PM','dd-MON-yy hh:mi:ss PM')

AND program LIKE 'oracle@%'

GROUP BY user_id, program, module, machine, sql_id

ORDER BY count(*) desc

)

WHERE rownum <= 20

/

Page 65: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Results of Process History

Page 66: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Tyler Muth ASH Mining Query

Page 67: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

ASH Mining Output

Additional Options: • Physical Read Averages • Physical Writes, (Max/Averages) • Redo Info • Login Info • Hard Parsing, etc.

Page 68: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Best Practice When Querying ASH Data

• Keep it Simple and don’t reinvent the wheel.

• Again- samples are an alias for time, not for counts.

• Understand what is valuable and compare to packaged reports.

• Be aware on RAC of node specific data.

• Take care when querying Obj#, File# and Block#, (still issues in different versions…)

• Check the time that is available in buffer, don’t assume!

Page 69: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Monitor, EM12c Style

• One More way to identify performance issues.

• Monitoring view ease for those less familiar with database performance.

Page 70: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Monitor Dashboard

Status of Statement

Wait Events

Degree of Parallelism

SQL_ID

SQL Text

Page 71: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Exadata and Offloading

• Drill down to specific statement within SQL Monitor will display offload efficiency per statement.

Page 72: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Full Detail of SQL Execution

Page 73: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

View Report

Page 74: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

SQL Monitor Report CLI SET LONG 1000000

SET LONGCHUNKSIZE 1000000

SET LINESIZE 1000

SET PAGESIZE 0

SET TRIM ON

SET TRIMSPOOL ON

SET ECHO OFF

SET FEEDBACK OFF

SELECT DBMS_SQLTUNE.report_sql_monitor(

sql_id => '5vh6y3b7tnv8r',

type => 'TEXT',

report_level => 'ALL') AS report

FROM dual;

Page 75: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Text Output of SQL Monitor

Page 76: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

One of the Best & Least Used Features in EM

Search SQL

Problem Query

Page 77: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

We Have the SQL_ID, What Next?

4v2tsp8dz0nhn is our SQL_ID

Go to the EM Console, (Example is EM12c)

Page 78: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Search SQL Interface

• Choose AWR Snapshots, (change Time Period), AWR Baselines and put SQL_ID

Page 79: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Click on Search

• SQL_ID link for SQL Details

• Split up by tabs for Cursor, AWR, Baselines and SQL Tuning Sets

• Plan Hash Value

• Elapsed Time

Page 80: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Data

Page 81: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Snapshot IDs

• Click on Snapshot ID and gather valuable data on resource usage during snapshot time or choose to view report.

Page 82: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR Report or Run ADDM Report

Page 83: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

AWR/ASH Links/Blogs

• Tyler Muth: http://tylermuth.wordpress.com/

• Kyle Hailey, John Beresniewicz, Graham Wood: http://ashmasters.com/

• Mine- “For the Love of ASH and AWR” http://dbakevlar.com/2011/02/for-the-love-of-awr-and-ash/

• Using AWR Reports: http://dbakevlar.com/2015/01/working-with-awr-reports-from-em12c/

• How to Use an ASH Report: http://dbakevlar.com/2015/02/how-to-use-an-ash-report-and-why/

• Karl Arao- http://karlarao.tiddlyspot.com/

• Guy Harrison- http://guyharrison.squarespace.com/opsgsamples/

Page 84: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Connect with me-

Page 85: AWR and eyond Deep Dive, (Dont Forget · 5/1/2015  · Title: How to Use the PowerPoint Template Author: Kellyn Pot'Vin Keywords: Oracle corporate Tagline Created Date: 5/1/2015 9:56:30