SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Downloaden Sie, um offline zu lesen
Sherlock Holmes for DBA’s




          Kellyn Pot’Vin
          Sr. Technical Consultant
          Enkitec
Denver DBA
 Kellyn Pot’Vin,
 Westminster, Colorado
 Oracle ACE, Sr. Technical Specialist at Enkitec
 Multi-Platform DBA
 Specialize in performance and management
  of large enterprise environments.
 Board of directors for RMOUG, Director of
  Training Days 2013, KSCOPE DB Track Lead
  2013
 Blog: DBAKevlar.com
 Twitter: @DBAKevlar
Challenges for Today’s DBA
 Added Complexity by Less Manual
  Configurations in Environment.
 Added Roles to DBA’s, either requiring
  more specializing and/or overall
  knowledge required.
 Added Features, systems.
 More open source solutions required,
  outside of standard design.
The Pitfall of All Optimization:
The “Tinsel Monkey”
“Tinsel” vs. “Valuable”
   Tinsel = anything that is shiny-
    ◦ graphs from EM without investigation.
    ◦ costs without research verifying are valid.
    ◦ Assumptions without proof.
 Tuning “Tinsel” results in no productive gain
  in performance in the database.
 Valuable optimization=Performance Gain.
 Performance gain should equal time savings.
 Time is gold.
What is Performance “Gold”
   Performance optimization that-
    ◦   saves valuable time to a long running process.
    ◦   Saves users valuable time to their work day.
    ◦   Saves results in value to the business.
    ◦   Re-allocates valuable resources, (memory, I/O
        or sessions) back to the database.
   Optimizing that saves time from
    maintenance work that can be re-
    allocated back to the business processing.
Saving DBA Time
 Sharing knowledge- Optimization should
  never be viewed as a “mystery process”
  or “voodoo”.
 Developers and Analysts should have
  access to DBA Performance Views.
 Ability to create explain plans.
 Access to Enterprise Manager “Top
  Activity” and drill downs.
Goals for the Attendee
 AWR, ASH and Tracing Knowledge.
 Steps to trouble-shooting an issue.


Over all, the goal of this session is for you
to always, ALWAYS, ALWAYS base any
changes you make on data and proof.
NEVER base changes on assumptions,
guesses or because you “read it
somewhere”.
Presentation Agenda
 Architecture
 History
 Reports
    ◦   ADDM
    ◦   ASH
    ◦   AWR
    ◦   Explain Plans
   Trace Files
    ◦ 10046
    ◦ 10053
AWR Repository
   Used not only by the AWR reports
    ◦ Automatic Database Diagnostic Monitor, (ADDM
      Reporting)
    ◦ SQL Tuning Advisor
    ◦ Segment Advisor
 By default, snapshots every hour. Retention
  is for 7 days. Both are modifiable.
 Snapshots can be taken at any time:
EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;
Running Tuning Pack Reports
 Through Enterprise Manager
 $ORACLE_HOME/rdbms/admin
    ◦   ADDM-                  addmrpt.sql
    ◦   ASH-                   ashrpt.sql
    ◦   AWR-                   awrrpt.sql
    ◦   SQL_ID Specific AWR-   awrsqrpt.sql
 These reports can be in HTML or TEXT
  versions.
 Require the Tuning and Management Pack
  license.
AWR Reports
Statspack on “Steroids”
 As detailed snapshot of database depending on
  intervals of snapshot setup, (hourly be default.)
 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 Tuning Pack License from
  Oracle.
Running AWR from Enterprise
Manager




• Post logging into the database, click on
  Performance.
• From Performance  AWR  AWR Report
ASH Report
   Best in smaller timeslots.
   Includes SQL_ID, object information and timeline of
    waits.
   Samples each active database session every second.
   Data is held in buffer in memory.
   Built into the Oracle kernel and accessed through the
    v$active_session_history view.
   In an AWR snapshot, 1 row in 10 from ASH buffer is
    placed into the AWR repository.
   Managed by the MMNL, (Memory Monitor Lite)
   Should not be used to track occurrence.
Running ASH Report from
    Enterprise Manager
•   ASH is always by time, not snapshot.
•   Set start date and time.
•   End date and time
•   Generate report
HTML Format ASH Report
ADDM Report High Lights
“Just the Facts” Report
 Produced from AWR Snapshots
 Broken down by “Findings and
  Recommendations”
 Identifies high-level misconfigurations.
 Lists what “Is Not an Impact”
 Do NOT recommend for non-DBA
  Personnel.
Creating Explain Plans
Creating an Explain plan:
EXPLAIN PLAN FOR <SQL STATEMENT>;
SELECT PLAN_TABLE_OUTPUT from
  table(dbms_xplan.display(‘plan_ta
  ble’,null,’basic’));
Preferred:
SELECT * FROM
  TABLE(DBMS_XPLAN.DISPLAY);
From a previous run, using SQL_ID:
SELECT * FROM
TABLE(DBMS_XPLAN.DISPLAY_AWR(‘SQL_I
  D’));
Trace Events and Levels
Event Level    Description
 10046        0 No statistics generated

                Standard trace output including parsing, executes and fetches
 10046        1 plus more
 10046        2 Same as Level 1
 10046        4 Level 1 + Bind Variables
 10046        8 Level 1 + Waits
 10046    12 Level 1 + Bind Variables & Waits


             Added in 11g to generate STAT line dumps for each
             execution. STAT dumping has been amended in 11g so that
             they are not aggregated across all executions but are dumped
 10046    16 after execution.
 10053        1 Dump Optimizer Statistics and Computations
 10053        2 Dump Optimizer Computations only
Tracing: 10046
   10046
    alter session set events '10046 trace name
      context forever, level 8';
    exec
    dbms_system.set_sql_trace_in_session(<sid>,<s
    erial#>,TRUE);
    exec
    dbms_system.set_ev(<sid>,<serial#>,10046,12,'
    ');
Tracing:10053
Alter session set events '10053 trace
  name context forever, level 1';
OR
begin
DBMS_SQLDIAG.DUMP_TRACE(p_sql_id=>‘<sql
  _id>',
  p_child_number=>0,
  p_component=>'Optimizer',
  p_file_id=>‘<distinguish trace
  name>');
end;
/
Trace Files are Too Big/Complex
 Become familiar with TKPROF for 10046
  trace files.
 If tracing often, sell cost effectiveness like
  advanced trace assistance tools like
  Method R’s “Mr. Trace”.
 Become confident in how to find bind
  variable, sql_id and column data values in
  a trace file.
 Become friends with find/search.. 
Real Life Scenario 1
 Developer notices that performance is poor in
   two standard transformation process.
 Process utilizes CTAS, (create table as)
 Believes parallel process is being degraded to
   serial due to limitations in CPU resources in
   database.
 First Step?
 Second Step?
Scenario 1, Step 1
 Explain plan of first CTAS shows that
  although SQL has parallel hints in “select”
  section, no parallel was designated in
  “create table” section of statement.
 Second process showed parallel in explain
  plan, but processing via Enterprise
  Manager did show only one process
  active for majority of time, other parallel
  slaves waiting.
Scenario 1, Step 2
 10046, level 8 trace of second process.
 Trace file clearly shows single slave
  session busy on function call, where
  parallel at all other processing.
 Inspection of code showed function
  needed to be created with
  “parallel_enable” clause addition.
Real Life Scenario 2
 11g Upgrade recently performed in
   environment.
 Overall performance good, but number of large
   DML processes degrading.
 Elapsed time extended, but time extension is
   spread across each transaction in the overall
   processing.
 First step?
 Second step?
Scenario 2, Step 1
 AWR reports show significant increase in
  times.
 IO has increased, physical reads on tables
  involved in DML shown as increase.
 No change in explain plans, utilizing 10g
  plans or new plans show no
  improvement.
Scenario 2, Step 2
 10053 trace, level 1 by SQL_ID’s of DML
  involved.
 Discovered in the trace file, full scans of
  tables due to following 11g parameter:
 CELL_OFFLOAD_PROCESSING=TRUE
 Per the MOS note- High 'ksv master wait'
  And 'ASM File Metadata Operation' Waits
  In Non-Exadata 11g [ID 1308282.1]
Real Life Scenario 3
 Users complain of performance
  degradation of main processing in data
  mart when larger, heavy concurrent
  processes.
 Same code executed in database when
  degradation occurs.
 AWR shows adequate SGA, PGA hit, high
  I/O.
 First step? Second Step?
Scenario 3, First Step:
 Memory and PGA show fine, yet high I/O, inspect the memory
  ,workarea and temp:
select vst.sql_text, swa.sql_id, swa.sid,
  swa.tablespace
, swa.operation_type
, trunc(swa.work_area_size/1024/1024) "PGA MB"
, trunc(swa.max_mem_used/1024/1024)"Mem MB"
, trunc(swa.tempseg_size/1024/1024)"Temp MB"
from v$sql_workarea_active swa, v$session vs,
  v$sqltext vst
where swa.sid=vs.sid
and swa.sql_id=vs.sql_id
and vs.sql_id=vst.sql_id
and vst.piece=0
order by swa.sql_id;
Scenario 3, Second Step:
 Workarea shows no PGA allocated,
  considering the size of temp table created
  as part of the CTAS, hash joins and hash
  group by sort.
 Performed 10048 trace of session.
 Action Plan: Traced session and noted the
  following, which was then located in
  procedure call: alter session set
  WORKAREA_SIZE_POLICY =
  MANUAL;
Optimization Data
   Database Level:
    ◦   AWR Reports
    ◦   ASH Reports
    ◦   ADDM Reports
    ◦   Enterprise Manager
    ◦   Queries
   Session Level:
    ◦ Explain Plans
    ◦ Traces
    ◦ Queries
Design of an Optimization Exercise
 Collect top 10 list of database
  performance challenges.
 Review with peers and user base.
 Create top 10 list that incorporates both
  the DBA list of top 10 and the User list.
 Divide the list into “low-hanging fruit” and
  those that will demand extensive
  resources to correct.
 Review the database again only after the
  “low-hanging fruit” has been addressed.
Summary
 Optimization is not an exact science, but
  following logical steps when scenarios
  develop is key.
 Always optimize for time savings
 Research to produce data, (proof) behind
  any optimize goaled exercise to eliminate
  wasted effort before an exercise is
  commenced.
Thank you
Kellyn Pot’Vin
Website: http://dbakevlar.com
and http://enkitec.com
Email: dbakevlar@gmail.com or kpotvin@enkitec.com
Twitter: @DBAKevlar
Facebook and LinkedIn: Kellyn Pot’Vin

Weitere ähnliche Inhalte

Was ist angesagt?

Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuningAbishek V S
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASKyle Hailey
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG PresentationBiju Thomas
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWRpasalapudi
 
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Aaron Shilo
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsfMao Geng
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningJugal Shah
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersAbdul Rahman Sherzad
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningngupt28
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - PresentationBiju Thomas
 
Sql Performance Tuning with ASH &amp; AWR: Real World Use Cases
Sql Performance Tuning with ASH &amp; AWR: Real World Use CasesSql Performance Tuning with ASH &amp; AWR: Real World Use Cases
Sql Performance Tuning with ASH &amp; AWR: Real World Use Casesvbarun01
 
resource governor
resource governorresource governor
resource governorAaron Shilo
 
Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!Revelation Technologies
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cDavid Yahalom
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014Enkitec
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuningYogiji Creations
 
Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAmin Uddin
 

Was ist angesagt? (20)

Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AAS
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
 
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event Schedulers
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation
 
Sql Performance Tuning with ASH &amp; AWR: Real World Use Cases
Sql Performance Tuning with ASH &amp; AWR: Real World Use CasesSql Performance Tuning with ASH &amp; AWR: Real World Use Cases
Sql Performance Tuning with ASH &amp; AWR: Real World Use Cases
 
resource governor
resource governorresource governor
resource governor
 
Hot sos em12c_metric_extensions
Hot sos em12c_metric_extensionsHot sos em12c_metric_extensions
Hot sos em12c_metric_extensions
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12c
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
 
Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure Presentation
 

Ähnlich wie Sherlock holmes for dba’s

Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Remote DBA Experts 11g Features
Remote DBA Experts 11g FeaturesRemote DBA Experts 11g Features
Remote DBA Experts 11g FeaturesRemote DBA Experts
 
Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoductionRiyaj Shamsudeen
 
22-4_PerformanceTuningUsingtheAdvisorFramework.pdf
22-4_PerformanceTuningUsingtheAdvisorFramework.pdf22-4_PerformanceTuningUsingtheAdvisorFramework.pdf
22-4_PerformanceTuningUsingtheAdvisorFramework.pdfyishengxi
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017Bob Ward
 
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?Jim Czuprynski
 
SQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV'sSQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV'sSparkhound Inc.
 
Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016Antonios Chatzipavlis
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 

Ähnlich wie Sherlock holmes for dba’s (20)

Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
 
Ashawr perf kscope
Ashawr perf kscopeAshawr perf kscope
Ashawr perf kscope
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
Remote DBA Experts 11g Features
Remote DBA Experts 11g FeaturesRemote DBA Experts 11g Features
Remote DBA Experts 11g Features
 
Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoduction
 
22-4_PerformanceTuningUsingtheAdvisorFramework.pdf
22-4_PerformanceTuningUsingtheAdvisorFramework.pdf22-4_PerformanceTuningUsingtheAdvisorFramework.pdf
22-4_PerformanceTuningUsingtheAdvisorFramework.pdf
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017
 
Less09 Data
Less09 DataLess09 Data
Less09 Data
 
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
 
SQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV'sSQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV's
 
Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016
 
Ash and awr deep dive hotsos
Ash and awr deep dive hotsosAsh and awr deep dive hotsos
Ash and awr deep dive hotsos
 
Store procedures
Store proceduresStore procedures
Store procedures
 
ASH and AWR on DB12c
ASH and AWR on DB12cASH and AWR on DB12c
ASH and AWR on DB12c
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 

Mehr von Kellyn Pot'Vin-Gorman

Redgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptxRedgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptxKellyn Pot'Vin-Gorman
 
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptxSQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptxKellyn Pot'Vin-Gorman
 
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"Kellyn Pot'Vin-Gorman
 
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 BIKellyn Pot'Vin-Gorman
 
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 ProfessionalKellyn Pot'Vin-Gorman
 
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 TricksKellyn Pot'Vin-Gorman
 
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 CloudKellyn Pot'Vin-Gorman
 
ODTUG Leadership Talk- WIT and Sponsorship
ODTUG Leadership Talk-  WIT and SponsorshipODTUG Leadership Talk-  WIT and Sponsorship
ODTUG Leadership Talk- WIT and SponsorshipKellyn Pot'Vin-Gorman
 
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 DataKellyn Pot'Vin-Gorman
 

Mehr von 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"
 
PASS Summit 2020
PASS Summit 2020PASS Summit 2020
PASS Summit 2020
 
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
 

Sherlock holmes for dba’s

  • 1. Sherlock Holmes for DBA’s Kellyn Pot’Vin Sr. Technical Consultant Enkitec
  • 2. Denver DBA  Kellyn Pot’Vin,  Westminster, Colorado  Oracle ACE, Sr. Technical Specialist at Enkitec  Multi-Platform DBA  Specialize in performance and management of large enterprise environments.  Board of directors for RMOUG, Director of Training Days 2013, KSCOPE DB Track Lead 2013  Blog: DBAKevlar.com  Twitter: @DBAKevlar
  • 3. Challenges for Today’s DBA  Added Complexity by Less Manual Configurations in Environment.  Added Roles to DBA’s, either requiring more specializing and/or overall knowledge required.  Added Features, systems.  More open source solutions required, outside of standard design.
  • 4. The Pitfall of All Optimization: The “Tinsel Monkey”
  • 5. “Tinsel” vs. “Valuable”  Tinsel = anything that is shiny- ◦ graphs from EM without investigation. ◦ costs without research verifying are valid. ◦ Assumptions without proof.  Tuning “Tinsel” results in no productive gain in performance in the database.  Valuable optimization=Performance Gain.  Performance gain should equal time savings.  Time is gold.
  • 6. What is Performance “Gold”  Performance optimization that- ◦ saves valuable time to a long running process. ◦ Saves users valuable time to their work day. ◦ Saves results in value to the business. ◦ Re-allocates valuable resources, (memory, I/O or sessions) back to the database.  Optimizing that saves time from maintenance work that can be re- allocated back to the business processing.
  • 7. Saving DBA Time  Sharing knowledge- Optimization should never be viewed as a “mystery process” or “voodoo”.  Developers and Analysts should have access to DBA Performance Views.  Ability to create explain plans.  Access to Enterprise Manager “Top Activity” and drill downs.
  • 8. Goals for the Attendee  AWR, ASH and Tracing Knowledge.  Steps to trouble-shooting an issue. Over all, the goal of this session is for you to always, ALWAYS, ALWAYS base any changes you make on data and proof. NEVER base changes on assumptions, guesses or because you “read it somewhere”.
  • 9. Presentation Agenda  Architecture  History  Reports ◦ ADDM ◦ ASH ◦ AWR ◦ Explain Plans  Trace Files ◦ 10046 ◦ 10053
  • 10.
  • 11.
  • 12. AWR Repository  Used not only by the AWR reports ◦ Automatic Database Diagnostic Monitor, (ADDM Reporting) ◦ SQL Tuning Advisor ◦ Segment Advisor  By default, snapshots every hour. Retention is for 7 days. Both are modifiable.  Snapshots can be taken at any time: EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;
  • 13. Running Tuning Pack Reports  Through Enterprise Manager  $ORACLE_HOME/rdbms/admin ◦ ADDM- addmrpt.sql ◦ ASH- ashrpt.sql ◦ AWR- awrrpt.sql ◦ SQL_ID Specific AWR- awrsqrpt.sql  These reports can be in HTML or TEXT versions.  Require the Tuning and Management Pack license.
  • 14. AWR Reports Statspack on “Steroids”  As detailed snapshot of database depending on intervals of snapshot setup, (hourly be default.)  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 Tuning Pack License from Oracle.
  • 15. Running AWR from Enterprise Manager • Post logging into the database, click on Performance. • From Performance  AWR  AWR Report
  • 16. ASH Report  Best in smaller timeslots.  Includes SQL_ID, object information and timeline of waits.  Samples each active database session every second.  Data is held in buffer in memory.  Built into the Oracle kernel and accessed through the v$active_session_history view.  In an AWR snapshot, 1 row in 10 from ASH buffer is placed into the AWR repository.  Managed by the MMNL, (Memory Monitor Lite)  Should not be used to track occurrence.
  • 17. Running ASH Report from Enterprise Manager • ASH is always by time, not snapshot. • Set start date and time. • End date and time • Generate report
  • 18. HTML Format ASH Report
  • 19. ADDM Report High Lights “Just the Facts” Report  Produced from AWR Snapshots  Broken down by “Findings and Recommendations”  Identifies high-level misconfigurations.  Lists what “Is Not an Impact”  Do NOT recommend for non-DBA Personnel.
  • 20. Creating Explain Plans Creating an Explain plan: EXPLAIN PLAN FOR <SQL STATEMENT>; SELECT PLAN_TABLE_OUTPUT from table(dbms_xplan.display(‘plan_ta ble’,null,’basic’)); Preferred: SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); From a previous run, using SQL_ID: SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_AWR(‘SQL_I D’));
  • 21. Trace Events and Levels Event Level Description 10046 0 No statistics generated Standard trace output including parsing, executes and fetches 10046 1 plus more 10046 2 Same as Level 1 10046 4 Level 1 + Bind Variables 10046 8 Level 1 + Waits 10046 12 Level 1 + Bind Variables & Waits Added in 11g to generate STAT line dumps for each execution. STAT dumping has been amended in 11g so that they are not aggregated across all executions but are dumped 10046 16 after execution. 10053 1 Dump Optimizer Statistics and Computations 10053 2 Dump Optimizer Computations only
  • 22. Tracing: 10046  10046 alter session set events '10046 trace name context forever, level 8'; exec dbms_system.set_sql_trace_in_session(<sid>,<s erial#>,TRUE); exec dbms_system.set_ev(<sid>,<serial#>,10046,12,' ');
  • 23. Tracing:10053 Alter session set events '10053 trace name context forever, level 1'; OR begin DBMS_SQLDIAG.DUMP_TRACE(p_sql_id=>‘<sql _id>', p_child_number=>0, p_component=>'Optimizer', p_file_id=>‘<distinguish trace name>'); end; /
  • 24. Trace Files are Too Big/Complex  Become familiar with TKPROF for 10046 trace files.  If tracing often, sell cost effectiveness like advanced trace assistance tools like Method R’s “Mr. Trace”.  Become confident in how to find bind variable, sql_id and column data values in a trace file.  Become friends with find/search.. 
  • 25. Real Life Scenario 1 Developer notices that performance is poor in two standard transformation process. Process utilizes CTAS, (create table as) Believes parallel process is being degraded to serial due to limitations in CPU resources in database. First Step? Second Step?
  • 26. Scenario 1, Step 1  Explain plan of first CTAS shows that although SQL has parallel hints in “select” section, no parallel was designated in “create table” section of statement.  Second process showed parallel in explain plan, but processing via Enterprise Manager did show only one process active for majority of time, other parallel slaves waiting.
  • 27. Scenario 1, Step 2  10046, level 8 trace of second process.  Trace file clearly shows single slave session busy on function call, where parallel at all other processing.  Inspection of code showed function needed to be created with “parallel_enable” clause addition.
  • 28. Real Life Scenario 2 11g Upgrade recently performed in environment. Overall performance good, but number of large DML processes degrading. Elapsed time extended, but time extension is spread across each transaction in the overall processing. First step? Second step?
  • 29. Scenario 2, Step 1  AWR reports show significant increase in times.  IO has increased, physical reads on tables involved in DML shown as increase.  No change in explain plans, utilizing 10g plans or new plans show no improvement.
  • 30. Scenario 2, Step 2  10053 trace, level 1 by SQL_ID’s of DML involved.  Discovered in the trace file, full scans of tables due to following 11g parameter:  CELL_OFFLOAD_PROCESSING=TRUE  Per the MOS note- High 'ksv master wait' And 'ASM File Metadata Operation' Waits In Non-Exadata 11g [ID 1308282.1]
  • 31. Real Life Scenario 3  Users complain of performance degradation of main processing in data mart when larger, heavy concurrent processes.  Same code executed in database when degradation occurs.  AWR shows adequate SGA, PGA hit, high I/O.  First step? Second Step?
  • 32. Scenario 3, First Step:  Memory and PGA show fine, yet high I/O, inspect the memory ,workarea and temp: select vst.sql_text, swa.sql_id, swa.sid, swa.tablespace , swa.operation_type , trunc(swa.work_area_size/1024/1024) "PGA MB" , trunc(swa.max_mem_used/1024/1024)"Mem MB" , trunc(swa.tempseg_size/1024/1024)"Temp MB" from v$sql_workarea_active swa, v$session vs, v$sqltext vst where swa.sid=vs.sid and swa.sql_id=vs.sql_id and vs.sql_id=vst.sql_id and vst.piece=0 order by swa.sql_id;
  • 33. Scenario 3, Second Step:  Workarea shows no PGA allocated, considering the size of temp table created as part of the CTAS, hash joins and hash group by sort.  Performed 10048 trace of session.  Action Plan: Traced session and noted the following, which was then located in procedure call: alter session set WORKAREA_SIZE_POLICY = MANUAL;
  • 34. Optimization Data  Database Level: ◦ AWR Reports ◦ ASH Reports ◦ ADDM Reports ◦ Enterprise Manager ◦ Queries  Session Level: ◦ Explain Plans ◦ Traces ◦ Queries
  • 35. Design of an Optimization Exercise  Collect top 10 list of database performance challenges.  Review with peers and user base.  Create top 10 list that incorporates both the DBA list of top 10 and the User list.  Divide the list into “low-hanging fruit” and those that will demand extensive resources to correct.  Review the database again only after the “low-hanging fruit” has been addressed.
  • 36. Summary  Optimization is not an exact science, but following logical steps when scenarios develop is key.  Always optimize for time savings  Research to produce data, (proof) behind any optimize goaled exercise to eliminate wasted effort before an exercise is commenced.
  • 37. Thank you Kellyn Pot’Vin Website: http://dbakevlar.com and http://enkitec.com Email: dbakevlar@gmail.com or kpotvin@enkitec.com Twitter: @DBAKevlar Facebook and LinkedIn: Kellyn Pot’Vin