SlideShare a Scribd company logo
1 of 96
Performance Data in Database 12c
AWR and ASH with EM13c
Kellyn Pot’Vin-Gorman, Technical Intelligence Manager for the Office of CTO
October 2016
2© 2016 Delphix Corporation
Who am I?
3© 2016 Delphix Corporation
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.
Stay on the Path…
4© 2016 Delphix Corporation
• 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.
Brief History
5© 2016 Delphix Corporation
The Location in EM12c For Some of Today’s Presentation…
6© 2016 Delphix Corporation
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;
Automatic Workload Repository, (AWR) Reports
7© 2016 Delphix Corporation
Buffer writes one direction,
we read the other!
8© 2016 Delphix Corporation
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.
AWR Reports Are Best Used For..
9© 2016 Delphix Corporation
Wasting Time…. 
Rarely is there value in this section.
As long is everything contains high percentages, move on.
10© 2016 Delphix Corporation
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
11© 2016 Delphix Corporation
Top SQL
Focus on Elapsed Time, but…
Displays Top SQL by:
CPU
IO
Gets
Reads, etc…
12© 2016 Delphix Corporation
Full SQL Statements
Linked from Top SQL Lists in HTML report via SQL_ID links.
Quick reference when needed.
13© 2016 Delphix Corporation
SGA “Thrashing”
14© 2016 Delphix Corporation
Why PGA is Important
What is an optimal vs. 1 or (M)ulti-pass executions?
15© 2016 Delphix Corporation
Why Can’t I Achieve 100%??
You shall not pass! (optimal, so 90%, that is… )
16© 2016 Delphix Corporation
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.
17© 2016 Delphix Corporation
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!
18© 2016 Delphix Corporation
Un-optimized vs. Optimized?
Percentages are low per object, (under 10%, which is a good sign for any database!)
This is an exadata, so it means they are either not in the buffer cache or the smart
Flash cache, which means un-optimized”.
This is “somewhat” expected and don’t panic unless you see high percentages.
19© 2016 Delphix Corporation
Initial Transaction Locks
10% rule applies here, too!
ALTER TABLE <name> initrans <xx>;
20© 2016 Delphix Corporation
RAC Interconnect Exchange
•Data from V$SYSMETRIC_HISTORY
•High Exchange rate can signal and issue.
21© 2016 Delphix Corporation
RAC Cache Interconnect Stats
22© 2016 Delphix Corporation
Transfer Rate Between RAC Nodes
23© 2016 Delphix Corporation
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.
ASH Reports
24© 2016 Delphix Corporation
Buffer writes one direction,
We read the other!
25© 2016 Delphix Corporation
Running ASH Report from Cloud Control
• ASH is by time, not snapshot.
• Set start date and time.
• End date and time
• Generate report
26© 2016 Delphix Corporation
HTML Format ASH
27© 2016 Delphix Corporation
Main ASH Info
28© 2016 Delphix Corporation
Top SQL, Top Sessions
29© 2016 Delphix Corporation
Top SQL Details
30© 2016 Delphix Corporation
Top Parallel, Top DB Files
31© 2016 Delphix Corporation
ASH Report- Use Case
@$ORACLE_HOME/rdbms/admin/ashrpt.sql;
 Report Format: Text
 Performance Issue during day, need to know what’s going on!
 Run ASH Report from the command line with SQL*Plus:
32© 2016 Delphix Corporation
“Interesting Part”
33© 2016 Delphix Corporation
Finally!
Select * from table(dbms_xplan.display_awr(‘43mp3mjufgnkg’));
34© 2016 Delphix Corporation
AWR and ASH from the Command Line Interface
All DBAs should know how to do this!
35© 2016 Delphix Corporation
$ORACLE_HOME/rdbms/admin/awrrpt.sql;
$ORACLE_HOME/rdbms/admin/ashrpt.sql;
$ORACLE_HOME/rdbms/admin/awrsqrpt.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.
Running Reports, Command Line
36© 2016 Delphix Corporation
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
AWR Info Report
37© 2016 Delphix Corporation
AWR General Information Report
38© 2016 Delphix Corporation
ASH Info Report
@$ORACLE_HOME/rdbms/admin/ashrpt.sql;
 Report Format: Text or HTML
39© 2016 Delphix Corporation
SQL_ID Specific AWR Report
40© 2016 Delphix Corporation
More defined reporting
No need to pull full report
Detail on waits that are of interest
Join to non-AWR objects
Examples and Ideas…
Querying ASH Data Directly
41© 2016 Delphix Corporation
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.
V$ACTIVE_SESSION_HISTORY
42© 2016 Delphix Corporation
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(*)
/
Session Averages
43© 2016 Delphix Corporation
Note the % of Background processes
Session Avg. Output
44© 2016 Delphix Corporation
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;
Inspecting What
45© 2016 Delphix Corporation
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.
10 Min. View of Waits by SQL_ID
46© 2016 Delphix Corporation
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;
Quantity of Events Occurred Over Small Amounts of Time
47© 2016 Delphix Corporation
Results, Where to Focus?
48© 2016 Delphix Corporation
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;
Transaction Wait Detail
49© 2016 Delphix Corporation
What TX row locks are occurring!
Transaction Lock Output
50© 2016 Delphix Corporation
Knowing What’s in the ASH Buffer
Deters from making assumptions on what data is
being queried.
Know your samples!
51© 2016 Delphix Corporation
Wait Events Across Nodes
52© 2016 Delphix Corporation
Query top 10 SQL_ID’s in the last 10 minutes?
53© 2016 Delphix Corporation
SQL_ID and CPU Usage
54© 2016 Delphix Corporation
IO Waits by Object from ASH
55© 2016 Delphix Corporation
SQL Text with ASH
SQL for most recent five minutes of sample data from
ASH
56© 2016 Delphix Corporation
SQL Results
SQL_ID, SQL Text, Sample Time that Process was
captured in.
57© 2016 Delphix Corporation
Graphing From the CLI, via Kyle Hailey-
58© 2016 Delphix Corporation
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 (
Formatting and Setup
URL to Kyle Hailey’s Original, Fully Formatted Query
59© 2016 Delphix Corporation
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');
**Thanks to Kyle Hailey for this great graph via the CLI
60© 2016 Delphix Corporation
Pivot the Wait Events
61© 2016 Delphix Corporation
DBA_HIST_ACTIVE_SESS_HISTORY
 SNAP_ID
 SAMPLE_ID
 SAMPLE_TIME
 SESSION_ID
 USER_ID
 SQL_ID
 WAIT_CLASS
 SESSION_STATE
 PGA_ALLOCATED
Digging into History
62© 2016 Delphix Corporation
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
/
Process Information
63© 2016 Delphix Corporation
Results of Process History
64© 2016 Delphix Corporation
Tyler Muth ASH Mining Query
65© 2016 Delphix Corporation
ASH Mining Output
Additional Options:
• Physical Read Averages
• Physical Writes, (Max/Averages)
• Redo Info
• Login Info
• Hard Parsing, etc.
66© 2016 Delphix Corporation
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!
Best Practice When Querying ASH Data
67© 2016 Delphix Corporation
It ran fine last week, now it doesn’t!
ETL loads have changed, but no one has released any new code!
The DBA says there hasn’t been any parameter changes to this database, but
I’m sure there have been.
Compare ADDM Resolution
How Often Are We Asked, “What Changed?”
68© 2016 Delphix Corporation
Uses Two AWR snapshots
Creates Report that-
- Compares SQL that is common and different.
- SGA changes
- IO/CPU bound issues
- Parameter Changes
What is Compare ADDM?
69© 2016 Delphix Corporation
Report Includes Following:
- Clear Demonstration of impact of change.
- Recommendations to address issue.
- Identifies causes behind change, (with limitations.)
- Lists Regressed SQL, too!
- Tip: If Installing to database for first time, (simple installation, nothing to
concern about, just pkg to fulfill views) you must have preferred
credentials SET of install will fail!
What is in an ADDM Compare?
70© 2016 Delphix Corporation
Choose focus period
Choose to compare to an Offset, Baseline or Custom
Executing a Report from EM12c
71© 2016 Delphix Corporation
Familiar interface with visual wait event comparisons.
Average # of sessions during each period are displayed.
2-3PM, 12th Vs. 13th
72© 2016 Delphix Corporation
High level data, highlight for analysis and recommendations.
Detail Report
73© 2016 Delphix Corporation
Any performance degradation is noted with the down arrow icon:
Regression SQL
74© 2016 Delphix Corporation
High Level data
Click on “Show Hot Object Breakdown” to see more detail.
Top Segments Causing IO Waits
75© 2016 Delphix Corporation
Comparisons of Memory, CPU, IO and Interconnect.
Memory Is there Virtual paging?
 Memory Base Period
 Memory Comparison Period
Resource Comparisons
76© 2016 Delphix Corporation
Is something OTHER than Oracle the cause?
Dashboard Provided for CPU, Memory, IO and Interconnect
77© 2016 Delphix Corporation
IO Bound Dashboard
 Base vs. comparison period
 Temp reads/writes specified
 Single block read latency
78© 2016 Delphix Corporation
One More way to identify performance issues.
Monitoring view ease for those less familiar with database performance.
SQL Monitor, EM12c Style
79© 2016 Delphix Corporation
SQL Monitor Dashboard
80© 2016 Delphix Corporation
Drill down to specific statement within SQL Monitor will display offload efficiency
per statement.
Exadata and Offloading
81© 2016 Delphix Corporation
Full Detail of SQL Execution
82© 2016 Delphix Corporation
View Report
83© 2016 Delphix Corporation
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;
SQL Monitor Report via the Command Line Interface
84© 2016 Delphix Corporation
Text Output of SQL Monitor
85© 2016 Delphix Corporation
One of the Best & Least Used Features in Enterprise
Manager: Search SQL
Problem Query
86© 2016 Delphix Corporation
4v2tsp8dz0nhn is our SQL_ID
Go to the EM Console, (Example is EM12c)
We Have the SQL_ID, What Next?
87© 2016 Delphix Corporation
Choose AWR Snapshots, (change Time Period), AWR Baselines and put
SQL_ID
Search SQL Interface
88© 2016 Delphix Corporation
SQL_ID link for SQL Details
Split up by tabs for Cursor, AWR, Baselines and SQL Tuning Sets
Plan Hash Value
Elapsed Time
Click on Search
89© 2016 Delphix Corporation
Snapshot Data
90© 2016 Delphix Corporation
Using the information provided by Search SQL, locate the correct plan hash value to create a profile from.
Identify
91© 2016 Delphix Corporation
SQL Details
92© 2016 Delphix Corporation
AWR Report or Run ADDM Report
93© 2016 Delphix Corporation
Baseline Impact?
Third Tab contains Baseline Information and links to verify if implemented.
94© 2016 Delphix Corporation
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/
SQL ID Specific Performance Information: http://dbakevlar.com/2015/05/sql-id-
specific-performance-information/
AWR/ASH Links/Blogs
95© 2016 Delphix Corporation
@DBAKevlar
https://dbakevlar.com http://delphix.com
kellyn@delphix.com
https://linkedin.com/in/kellynpotvin
Connect With Me
96© 2016 Delphix Corporation
Q&A
Thank you!

More Related Content

What's hot

2.Oracle’S High Availability Vision
2.Oracle’S High Availability Vision2.Oracle’S High Availability Vision
2.Oracle’S High Availability Vision
Ermando
 
Power of the AWR Warehouse- HotSos Symposium 2015
Power of the AWR Warehouse-  HotSos Symposium 2015Power of the AWR Warehouse-  HotSos Symposium 2015
Power of the AWR Warehouse- HotSos Symposium 2015
Kellyn Pot'Vin-Gorman
 
Oracle & sql server comparison 2
Oracle & sql server comparison 2Oracle & sql server comparison 2
Oracle & sql server comparison 2
Mohsen B
 
Getting optimal performance from oracle e business suite(aioug aug2015)
Getting optimal performance from oracle e business suite(aioug aug2015)Getting optimal performance from oracle e business suite(aioug aug2015)
Getting optimal performance from oracle e business suite(aioug aug2015)
pasalapudi123
 

What's hot (20)

2.Oracle’S High Availability Vision
2.Oracle’S High Availability Vision2.Oracle’S High Availability Vision
2.Oracle’S High Availability Vision
 
Using AWR for SQL Analysis
Using AWR for SQL AnalysisUsing AWR for SQL Analysis
Using AWR for SQL Analysis
 
Kellyn Pot'Vin-Gorman - Power awr warehouse2
Kellyn Pot'Vin-Gorman - Power awr warehouse2Kellyn Pot'Vin-Gorman - Power awr warehouse2
Kellyn Pot'Vin-Gorman - Power awr warehouse2
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
UKOUG
UKOUG UKOUG
UKOUG
 
Optimizing the Enterprise Manager 12c
Optimizing the Enterprise Manager 12cOptimizing the Enterprise Manager 12c
Optimizing the Enterprise Manager 12c
 
Power of the AWR Warehouse- HotSos Symposium 2015
Power of the AWR Warehouse-  HotSos Symposium 2015Power of the AWR Warehouse-  HotSos Symposium 2015
Power of the AWR Warehouse- HotSos Symposium 2015
 
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RACAUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
 
ORAchk EXAchk what's new in 12.1.0.2.7
ORAchk EXAchk what's new in 12.1.0.2.7ORAchk EXAchk what's new in 12.1.0.2.7
ORAchk EXAchk what's new in 12.1.0.2.7
 
Performance Tuning intro
Performance Tuning introPerformance Tuning intro
Performance Tuning intro
 
How to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata EnvironmentsHow to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata Environments
 
Machine Learning and AI at Oracle
Machine Learning and AI at OracleMachine Learning and AI at Oracle
Machine Learning and AI at Oracle
 
Exachk Customer Presentation
Exachk Customer PresentationExachk Customer Presentation
Exachk Customer Presentation
 
Performance in the Oracle Cloud
Performance in the Oracle CloudPerformance in the Oracle Cloud
Performance in the Oracle Cloud
 
AIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RACAIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RAC
 
Oracle & sql server comparison 2
Oracle & sql server comparison 2Oracle & sql server comparison 2
Oracle & sql server comparison 2
 
Getting optimal performance from oracle e business suite(aioug aug2015)
Getting optimal performance from oracle e business suite(aioug aug2015)Getting optimal performance from oracle e business suite(aioug aug2015)
Getting optimal performance from oracle e business suite(aioug aug2015)
 
TFA, ORAchk and EXAchk 20.2 - What's new
TFA, ORAchk and EXAchk 20.2 - What's new TFA, ORAchk and EXAchk 20.2 - What's new
TFA, ORAchk and EXAchk 20.2 - What's new
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
20 tips and tricks with the Autonomous Database
20 tips and tricks with the Autonomous Database20 tips and tricks with the Autonomous Database
20 tips and tricks with the Autonomous Database
 

Similar to AWR and ASH Advanced Usage with DB12c

Muhammad Hameed Chaudhry
Muhammad Hameed ChaudhryMuhammad Hameed Chaudhry
Muhammad Hameed Chaudhry
Aamir Chaudhry
 

Similar to AWR and ASH Advanced Usage with DB12c (20)

AWR and ASH in an EM12c World
AWR and ASH in an EM12c WorldAWR and ASH in an EM12c World
AWR and ASH in an EM12c World
 
ASH and AWR on DB12c
ASH and AWR on DB12cASH and AWR on DB12c
ASH and AWR on DB12c
 
Kellyn Pot'Vin-Gorman - Awr and Ash
Kellyn Pot'Vin-Gorman - Awr and AshKellyn Pot'Vin-Gorman - Awr and Ash
Kellyn Pot'Vin-Gorman - Awr and Ash
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
 
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
 
Ash and awr performance data2
Ash and awr performance data2Ash and awr performance data2
Ash and awr performance data2
 
Whats new in Oracle Database 12c release 12.1.0.2
Whats new in Oracle Database 12c release 12.1.0.2Whats new in Oracle Database 12c release 12.1.0.2
Whats new in Oracle Database 12c release 12.1.0.2
 
Adop and maintenance task presentation 151015
Adop and maintenance task presentation 151015Adop and maintenance task presentation 151015
Adop and maintenance task presentation 151015
 
Oracle TFA 12.1.2.8.4 - Whats New
Oracle TFA 12.1.2.8.4 - Whats NewOracle TFA 12.1.2.8.4 - Whats New
Oracle TFA 12.1.2.8.4 - Whats New
 
TFA_Whats_New_in version 12.1.2.8.4
TFA_Whats_New_in version 12.1.2.8.4TFA_Whats_New_in version 12.1.2.8.4
TFA_Whats_New_in version 12.1.2.8.4
 
Sherlock holmes for dba’s
Sherlock holmes for dba’sSherlock holmes for dba’s
Sherlock holmes for dba’s
 
PASS Summit 2020
PASS Summit 2020PASS Summit 2020
PASS Summit 2020
 
Muhammad Hameed Chaudhry
Muhammad Hameed ChaudhryMuhammad Hameed Chaudhry
Muhammad Hameed Chaudhry
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore Index
 
Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...
 
Stream Analytics
Stream Analytics Stream Analytics
Stream Analytics
 
What’s New in Oracle Database 12c for PHP
What’s New in Oracle Database 12c for PHPWhat’s New in Oracle Database 12c for PHP
What’s New in Oracle Database 12c for PHP
 
ORACLE
ORACLEORACLE
ORACLE
 
From oracle to hadoop with Sqoop and other tools
From oracle to hadoop with Sqoop and other toolsFrom oracle to hadoop with Sqoop and other tools
From oracle to hadoop with Sqoop and other tools
 
Make Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For ItMake Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For It
 

More from Kellyn Pot'Vin-Gorman

More from Kellyn Pot'Vin-Gorman (20)

Redgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptxRedgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptx
 
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptxSQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
 
Boston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptxBoston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptx
 
Oracle on Azure IaaS 2023 Update
Oracle on Azure IaaS 2023 UpdateOracle on Azure IaaS 2023 Update
Oracle on Azure IaaS 2023 Update
 
IaaS for DBAs in Azure
IaaS for DBAs in AzureIaaS for DBAs in Azure
IaaS for DBAs in Azure
 
Being Successful with ADHD
Being Successful with ADHDBeing Successful with ADHD
Being Successful with ADHD
 
Azure DBA with IaaS
Azure DBA with IaaSAzure DBA with IaaS
Azure DBA with IaaS
 
Turning ADHD into "Awesome Dynamic Highly Dependable"
Turning ADHD into "Awesome Dynamic Highly Dependable"Turning ADHD into "Awesome Dynamic Highly Dependable"
Turning ADHD into "Awesome Dynamic Highly Dependable"
 
DevOps in Silos
DevOps in SilosDevOps in Silos
DevOps in Silos
 
Azure Databases with IaaS
Azure Databases with IaaSAzure Databases with IaaS
Azure Databases with IaaS
 
How to Win When Migrating to Azure
How to Win When Migrating to AzureHow to Win When Migrating to Azure
How to Win When Migrating to Azure
 
Securing Power BI Data
Securing Power BI DataSecuring Power BI Data
Securing Power BI Data
 
Cepta The Future of Data with Power BI
Cepta The Future of Data with Power BICepta The Future of Data with Power BI
Cepta The Future of Data with Power BI
 
Pass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft ProfessionalPass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft Professional
 
Taming the shrew Power BI
Taming the shrew Power BITaming the shrew Power BI
Taming the shrew Power BI
 
PASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and TricksPASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and Tricks
 
Power BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle CloudPower BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle Cloud
 
ODTUG Leadership Talk- WIT and Sponsorship
ODTUG Leadership Talk-  WIT and SponsorshipODTUG Leadership Talk-  WIT and Sponsorship
ODTUG Leadership Talk- WIT and Sponsorship
 
DevOps and Decoys How to Build a Successful Microsoft DevOps Including the Data
DevOps and Decoys  How to Build a Successful Microsoft DevOps Including the DataDevOps and Decoys  How to Build a Successful Microsoft DevOps Including the Data
DevOps and Decoys How to Build a Successful Microsoft DevOps Including the Data
 
GDPR- The Buck Stops Here
GDPR-  The Buck Stops HereGDPR-  The Buck Stops Here
GDPR- The Buck Stops Here
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

AWR and ASH Advanced Usage with DB12c

  • 1. Performance Data in Database 12c AWR and ASH with EM13c Kellyn Pot’Vin-Gorman, Technical Intelligence Manager for the Office of CTO October 2016
  • 2. 2© 2016 Delphix Corporation Who am I?
  • 3. 3© 2016 Delphix Corporation 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. Stay on the Path…
  • 4. 4© 2016 Delphix Corporation • 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. Brief History
  • 5. 5© 2016 Delphix Corporation The Location in EM12c For Some of Today’s Presentation…
  • 6. 6© 2016 Delphix Corporation 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; Automatic Workload Repository, (AWR) Reports
  • 7. 7© 2016 Delphix Corporation Buffer writes one direction, we read the other!
  • 8. 8© 2016 Delphix Corporation 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. AWR Reports Are Best Used For..
  • 9. 9© 2016 Delphix Corporation Wasting Time….  Rarely is there value in this section. As long is everything contains high percentages, move on.
  • 10. 10© 2016 Delphix Corporation 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
  • 11. 11© 2016 Delphix Corporation Top SQL Focus on Elapsed Time, but… Displays Top SQL by: CPU IO Gets Reads, etc…
  • 12. 12© 2016 Delphix Corporation Full SQL Statements Linked from Top SQL Lists in HTML report via SQL_ID links. Quick reference when needed.
  • 13. 13© 2016 Delphix Corporation SGA “Thrashing”
  • 14. 14© 2016 Delphix Corporation Why PGA is Important What is an optimal vs. 1 or (M)ulti-pass executions?
  • 15. 15© 2016 Delphix Corporation Why Can’t I Achieve 100%?? You shall not pass! (optimal, so 90%, that is… )
  • 16. 16© 2016 Delphix Corporation 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.
  • 17. 17© 2016 Delphix Corporation 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!
  • 18. 18© 2016 Delphix Corporation Un-optimized vs. Optimized? Percentages are low per object, (under 10%, which is a good sign for any database!) This is an exadata, so it means they are either not in the buffer cache or the smart Flash cache, which means un-optimized”. This is “somewhat” expected and don’t panic unless you see high percentages.
  • 19. 19© 2016 Delphix Corporation Initial Transaction Locks 10% rule applies here, too! ALTER TABLE <name> initrans <xx>;
  • 20. 20© 2016 Delphix Corporation RAC Interconnect Exchange •Data from V$SYSMETRIC_HISTORY •High Exchange rate can signal and issue.
  • 21. 21© 2016 Delphix Corporation RAC Cache Interconnect Stats
  • 22. 22© 2016 Delphix Corporation Transfer Rate Between RAC Nodes
  • 23. 23© 2016 Delphix Corporation 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. ASH Reports
  • 24. 24© 2016 Delphix Corporation Buffer writes one direction, We read the other!
  • 25. 25© 2016 Delphix Corporation Running ASH Report from Cloud Control • ASH is by time, not snapshot. • Set start date and time. • End date and time • Generate report
  • 26. 26© 2016 Delphix Corporation HTML Format ASH
  • 27. 27© 2016 Delphix Corporation Main ASH Info
  • 28. 28© 2016 Delphix Corporation Top SQL, Top Sessions
  • 29. 29© 2016 Delphix Corporation Top SQL Details
  • 30. 30© 2016 Delphix Corporation Top Parallel, Top DB Files
  • 31. 31© 2016 Delphix Corporation ASH Report- Use Case @$ORACLE_HOME/rdbms/admin/ashrpt.sql;  Report Format: Text  Performance Issue during day, need to know what’s going on!  Run ASH Report from the command line with SQL*Plus:
  • 32. 32© 2016 Delphix Corporation “Interesting Part”
  • 33. 33© 2016 Delphix Corporation Finally! Select * from table(dbms_xplan.display_awr(‘43mp3mjufgnkg’));
  • 34. 34© 2016 Delphix Corporation AWR and ASH from the Command Line Interface All DBAs should know how to do this!
  • 35. 35© 2016 Delphix Corporation $ORACLE_HOME/rdbms/admin/awrrpt.sql; $ORACLE_HOME/rdbms/admin/ashrpt.sql; $ORACLE_HOME/rdbms/admin/awrsqrpt.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. Running Reports, Command Line
  • 36. 36© 2016 Delphix Corporation 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 AWR Info Report
  • 37. 37© 2016 Delphix Corporation AWR General Information Report
  • 38. 38© 2016 Delphix Corporation ASH Info Report @$ORACLE_HOME/rdbms/admin/ashrpt.sql;  Report Format: Text or HTML
  • 39. 39© 2016 Delphix Corporation SQL_ID Specific AWR Report
  • 40. 40© 2016 Delphix Corporation More defined reporting No need to pull full report Detail on waits that are of interest Join to non-AWR objects Examples and Ideas… Querying ASH Data Directly
  • 41. 41© 2016 Delphix Corporation 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. V$ACTIVE_SESSION_HISTORY
  • 42. 42© 2016 Delphix Corporation 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(*) / Session Averages
  • 43. 43© 2016 Delphix Corporation Note the % of Background processes Session Avg. Output
  • 44. 44© 2016 Delphix Corporation 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; Inspecting What
  • 45. 45© 2016 Delphix Corporation 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. 10 Min. View of Waits by SQL_ID
  • 46. 46© 2016 Delphix Corporation 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; Quantity of Events Occurred Over Small Amounts of Time
  • 47. 47© 2016 Delphix Corporation Results, Where to Focus?
  • 48. 48© 2016 Delphix Corporation 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; Transaction Wait Detail
  • 49. 49© 2016 Delphix Corporation What TX row locks are occurring! Transaction Lock Output
  • 50. 50© 2016 Delphix Corporation Knowing What’s in the ASH Buffer Deters from making assumptions on what data is being queried. Know your samples!
  • 51. 51© 2016 Delphix Corporation Wait Events Across Nodes
  • 52. 52© 2016 Delphix Corporation Query top 10 SQL_ID’s in the last 10 minutes?
  • 53. 53© 2016 Delphix Corporation SQL_ID and CPU Usage
  • 54. 54© 2016 Delphix Corporation IO Waits by Object from ASH
  • 55. 55© 2016 Delphix Corporation SQL Text with ASH SQL for most recent five minutes of sample data from ASH
  • 56. 56© 2016 Delphix Corporation SQL Results SQL_ID, SQL Text, Sample Time that Process was captured in.
  • 57. 57© 2016 Delphix Corporation Graphing From the CLI, via Kyle Hailey-
  • 58. 58© 2016 Delphix Corporation 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 ( Formatting and Setup URL to Kyle Hailey’s Original, Fully Formatted Query
  • 59. 59© 2016 Delphix Corporation 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'); **Thanks to Kyle Hailey for this great graph via the CLI
  • 60. 60© 2016 Delphix Corporation Pivot the Wait Events
  • 61. 61© 2016 Delphix Corporation DBA_HIST_ACTIVE_SESS_HISTORY  SNAP_ID  SAMPLE_ID  SAMPLE_TIME  SESSION_ID  USER_ID  SQL_ID  WAIT_CLASS  SESSION_STATE  PGA_ALLOCATED Digging into History
  • 62. 62© 2016 Delphix Corporation 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 / Process Information
  • 63. 63© 2016 Delphix Corporation Results of Process History
  • 64. 64© 2016 Delphix Corporation Tyler Muth ASH Mining Query
  • 65. 65© 2016 Delphix Corporation ASH Mining Output Additional Options: • Physical Read Averages • Physical Writes, (Max/Averages) • Redo Info • Login Info • Hard Parsing, etc.
  • 66. 66© 2016 Delphix Corporation 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! Best Practice When Querying ASH Data
  • 67. 67© 2016 Delphix Corporation It ran fine last week, now it doesn’t! ETL loads have changed, but no one has released any new code! The DBA says there hasn’t been any parameter changes to this database, but I’m sure there have been. Compare ADDM Resolution How Often Are We Asked, “What Changed?”
  • 68. 68© 2016 Delphix Corporation Uses Two AWR snapshots Creates Report that- - Compares SQL that is common and different. - SGA changes - IO/CPU bound issues - Parameter Changes What is Compare ADDM?
  • 69. 69© 2016 Delphix Corporation Report Includes Following: - Clear Demonstration of impact of change. - Recommendations to address issue. - Identifies causes behind change, (with limitations.) - Lists Regressed SQL, too! - Tip: If Installing to database for first time, (simple installation, nothing to concern about, just pkg to fulfill views) you must have preferred credentials SET of install will fail! What is in an ADDM Compare?
  • 70. 70© 2016 Delphix Corporation Choose focus period Choose to compare to an Offset, Baseline or Custom Executing a Report from EM12c
  • 71. 71© 2016 Delphix Corporation Familiar interface with visual wait event comparisons. Average # of sessions during each period are displayed. 2-3PM, 12th Vs. 13th
  • 72. 72© 2016 Delphix Corporation High level data, highlight for analysis and recommendations. Detail Report
  • 73. 73© 2016 Delphix Corporation Any performance degradation is noted with the down arrow icon: Regression SQL
  • 74. 74© 2016 Delphix Corporation High Level data Click on “Show Hot Object Breakdown” to see more detail. Top Segments Causing IO Waits
  • 75. 75© 2016 Delphix Corporation Comparisons of Memory, CPU, IO and Interconnect. Memory Is there Virtual paging?  Memory Base Period  Memory Comparison Period Resource Comparisons
  • 76. 76© 2016 Delphix Corporation Is something OTHER than Oracle the cause? Dashboard Provided for CPU, Memory, IO and Interconnect
  • 77. 77© 2016 Delphix Corporation IO Bound Dashboard  Base vs. comparison period  Temp reads/writes specified  Single block read latency
  • 78. 78© 2016 Delphix Corporation One More way to identify performance issues. Monitoring view ease for those less familiar with database performance. SQL Monitor, EM12c Style
  • 79. 79© 2016 Delphix Corporation SQL Monitor Dashboard
  • 80. 80© 2016 Delphix Corporation Drill down to specific statement within SQL Monitor will display offload efficiency per statement. Exadata and Offloading
  • 81. 81© 2016 Delphix Corporation Full Detail of SQL Execution
  • 82. 82© 2016 Delphix Corporation View Report
  • 83. 83© 2016 Delphix Corporation 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; SQL Monitor Report via the Command Line Interface
  • 84. 84© 2016 Delphix Corporation Text Output of SQL Monitor
  • 85. 85© 2016 Delphix Corporation One of the Best & Least Used Features in Enterprise Manager: Search SQL Problem Query
  • 86. 86© 2016 Delphix Corporation 4v2tsp8dz0nhn is our SQL_ID Go to the EM Console, (Example is EM12c) We Have the SQL_ID, What Next?
  • 87. 87© 2016 Delphix Corporation Choose AWR Snapshots, (change Time Period), AWR Baselines and put SQL_ID Search SQL Interface
  • 88. 88© 2016 Delphix Corporation SQL_ID link for SQL Details Split up by tabs for Cursor, AWR, Baselines and SQL Tuning Sets Plan Hash Value Elapsed Time Click on Search
  • 89. 89© 2016 Delphix Corporation Snapshot Data
  • 90. 90© 2016 Delphix Corporation Using the information provided by Search SQL, locate the correct plan hash value to create a profile from. Identify
  • 91. 91© 2016 Delphix Corporation SQL Details
  • 92. 92© 2016 Delphix Corporation AWR Report or Run ADDM Report
  • 93. 93© 2016 Delphix Corporation Baseline Impact? Third Tab contains Baseline Information and links to verify if implemented.
  • 94. 94© 2016 Delphix Corporation 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/ SQL ID Specific Performance Information: http://dbakevlar.com/2015/05/sql-id- specific-performance-information/ AWR/ASH Links/Blogs
  • 95. 95© 2016 Delphix Corporation @DBAKevlar https://dbakevlar.com http://delphix.com kellyn@delphix.com https://linkedin.com/in/kellynpotvin Connect With Me
  • 96. 96© 2016 Delphix Corporation Q&A Thank you!