maximize db performance top10 tips final

Upload: solodba

Post on 04-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    1/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 131

    Maximize Oracle Database Performance

    with Oracle Enterprise Manager 12c:Top 10 Tips & Tricks

    Scott McNeil

    Principal Product Director, Oracle

    Deba ChatterjeePrincipal Product Manager, Oracle

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    2/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 132

    Top 10 Common Problems:

    1. Performance was fine yesterday, today my application is really slow?

    2. My database has hung? I do not want to bounce it.

    3. I enabled parallel query, yet this query is taking to long. Why?4. My simple query takes so long. Whats wrong with the database?

    5. Detecting runaway queries with metric extensions?

    6. What happened last night, the batch job took twice the time to finish?

    7. The SQL Response Metric crossed the warning threshold. What is wrong?

    8. We just went live after a DB change and now performance has regressed, 9. We are going through a schema consolidation, how can I ensure one sessi

    away with all my system resources?

    10. The new BI system has very aggressive SLAs defined. How can we ensureperformance across the system?

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    3/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.3

    3 Types ofPerformanceManagement

    ReactivePerformance

    Management

    ProactivePerformance

    Management

    P

    M

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    4/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.4

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    5/56Copyright 2012, Oracle and/or its affiliates. All rights reserved.5

    Reactive Performance Management

    Comparing PerformanceAcross Two Time Periods

    Database Hang Analysis

    SQL Performance AnalysisI

    SQL Performance Analysis -II

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    6/56Copyright 2012, Oracle and/or its affiliates. All rights reserved.6

    Comparing Performance AcrossTwo Periods

    Inconsistent Performance

    Over utilization of system resources

    High load ad hoc query consuming resources Change in execution plan of query

    Parallel execution downgrade

    Performance was fine yesterday, today my

    application is really slow?

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    7/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.7

    Tip: Compare Period ADDM

    Full ADDM analysis across two AWR snapshot periods

    Detects causes, measure effects, then correlates them

    Causes: workload changes, configuration changes

    Effects: regressed SQL, reach resource limits (CPU, I/O, memory, interconnect)

    Makes actionable recommendations along with quantified impact

    AWR SnapshotPeriod 1

    AWR SnapshotPeriod 2

    Analysis ReportComparePeriod ADDM

    S

    R

    I

    U

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    8/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.8

    30% sm

    10% new

    Compare Period ADDM: Method

    Identify what changed Configuration changes, workload

    changes

    Quantify performance differences

    Uses DB Time as basis formeasuring performance

    Identify root cause Correlate performance

    differences with changes

    Top SQL

    Read I/O

    Buffer cacaused

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    9/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.9

    Reactive Performance Management

    Comparing Performance AcrossTwo Time Periods

    Database Hang Analysis

    SQL Performance Analysis I

    SQL Performance Analysis II

    CPe

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    10/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.10

    Database Hang Analysis

    Database Hung state

    Blocking Sessions

    Memory allocation issues Library cache issues

    Unresponsive Storage (ASM)

    Interconnect problems

    My database is hung? I do not want to

    bounce it.

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    11/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.11

    Tip: Real-Time ADDMEM Agent

    JDBC Connection

    Diagnostic Connection

    Database

    ADDMAnalys

    Uses a pre-established diagnostic connection for unresponsive sys

    Initiates a standard JDBC connection for real-time analysis

    Diagnostic connection collects data without holding latches or runn

    First intelligent advisor to diagnose problems in real-time as they ohow sick the system is

    Real-Time Analysis

    Unresponsive DB

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    12/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.12

    Real-Time ADDM

    Real-time analysis of hung or slow database systems Holistically identify global resource contentions and deadlocks Quantified performance impact Precise, actionable recommendations Provide cluster-wide analysis for RAC

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    13/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.13

    Reactive Performance Management

    Comparing Performance AcrossTwo Time Periods

    Database Hang Analysis

    SQL Performance Analysis I

    SQL Performance Analysis II

    CPeri

    ReA

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    14/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.14

    SQL Performance Analysis

    I enabled parallel query, yet this query is takingso long. Can you take a look?

    Parallel Downgrades

    Uncontrolled parallel execution

    Parallel Server availability

    Object level settings

    Session level settings

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    15/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.15

    Tip: Real-Time SQL MonitoringInsert Executed with Parallel Hint

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    16/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.16

    Real-Time SQL MonitoringParallel Tab

    Parallel Coordinator busy for the entire duration!!

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    17/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.17

    Real-Time SQL MonitoringEnabled Parallel DML

    Parallel Slaves busy for the entire duration!!!

    SQL P f A l i

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    18/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.18

    SQL Performance Analysis

    My simple query takes so long. Whats wrong

    with the database?

    SQL Performance Problems

    Statistics

    Resources Application issues

    Parallelism

    Initialization parameters

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    19/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.19

    Tip: Real-Time SQL MonitoringSQL with Count and Group By

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    20/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.20

    Real-Time SQL MonitoringSQL with Count and Group By

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    21/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.21

    Real-Time SQL MonitoringPGA Size Increased

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    22/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.22

    Reactive Performance Management

    Mo

    Comparing Performance AcrossTwo Time Periods

    Database Hang Analysis

    SQL Performance Analysis I

    SQL Performance Analysis II

    CPeri

    ReA

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    23/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.23

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    24/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.24

    Proactive Performance Management

    Dealing with run awayqueries

    Understanding WorkloadProfile I

    Understanding WorkloadProfile II

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    25/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.25

    Runaway Query

    SQL that consumes too much CPU or executes too long BUGS: Need to find during Development and Testing conte

    Real-time SQL Monitoring introduced in DB 11g

    Monitors long-running and parallel query (PQ) SQL execut

    Rich interactive user interface and Active Report

    GV$SQL_MONITOR

    Not really intended for user-written queries

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    26/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.26

    What are Oracle Enterprise Manager 12c Metric Ex

    User extensions to EM target monitoring metrics

    Replacement for EM 10/11 User Defined Metrics (UDM) First-class EM Metrics: Metric Group of Metric Columns

    Multiple measure columns with alert threshold capability

    Key column support, including key-specific thresholds

    Supports SQL, OS, and JMX fetchlets

    Whatever the target type already uses

    Lifecycle support: Develop, Test, Deploy

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    27/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.27

    GV$SQL_MONITORquery

    SQL_ID: key column

    TotalCPUSecs

    TotalElapsedSecs

    Execute every 15-minutes(to not miss anything)

    Set alert thresholds onCPU and Elapsed times

    Design Metric Extension

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    28/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.28

    Find Metric Extensions

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    29/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.29

    Manage Metric Extensions

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    30/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.30

    Guided wizard makes iteasy

    Well organized

    Excellentexplanations

    Develop and test onany database beforedeploying to production

    Create Metric Extension

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    31/56

    P ti P f M t

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    32/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.32

    Proactive Performance Management

    Run away queries

    Understanding WorkloadProfile I

    Understanding WorkloadProfile II

    MExte

    Understanding Workload Profile

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    33/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1333

    Understanding Workload Profile

    What happened last night, the batch job tooktwice the time to finish ?

    We can look at AWR and ASH Data

    Averaged out over the snapshot window

    On-disk ASH Data

    Sampled every 10 seconds

    Very difficult to detect such issues in the past

    Database Response Time AnalysisAW

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    34/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1334

    Database Response Time Analysis AW

    AWR top 5 section

    shows the Wait Classwhich contributes mostto DB wait time

    Objects involved in TX rcontention can be identSegment Statistics secti

    Foreground Wait Class secAWR to see distribution of Dover Waits classes

    From AWR to ASH

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    35/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1335

    From AWR to ASH

    ASH report for theperiod of increase

    of Application waitswill show the samewaits as AWR

    Can I get the App

    Module which sufrom this type ofcontention ?

    Extracting More Data From ASH

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    36/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1336

    Extracting More Data From ASH

    Identify SQL statements and sessions impacted by waits Application Wait Class

    Extracting More Data From ASH

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    37/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1337

    Extracting More Data From ASH

    Get a list of blocking sessions and DB objects !

    Proactive Performance Management

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    38/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1338

    Proactive Performance Management

    Reactive Tracing of LongRunning Programs

    Understanding WorkloadProfile - I

    Understanding WorkloadProfile - II

    DatOpe

    CoAWR

    Understanding Workload Profile

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    39/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.39

    g

    The SQL Response Metric crossed the warningthreshold. What is wrong?

    Several factors can impact SQL Response time Increased or unusual load on system

    Hardware issues

    Runaway queries consuming system resources

    Changes in execution plans

    Missing or stale object statistics

    Need a mechanism to quickly analyze in-memoryperformance data

    Tip: Understanding Workload Profile

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    40/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.40

    Tip: Understanding Workload Profile

    Graphical ASH report for advanced analysis

    Provides visual filtering for recursive drill-downs

    Select any time period for analysis

    Analyze performance across many dimensions

    Different visualizations: STree Map

    Collaborate with others uReports

    Proactive Performance Management

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    41/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.41

    Proactive Performance Management

    Reactive Tracing of LongRunning Programs

    Understanding WorkloadProfile - I

    Understanding WorkloadProfile - II

    DatOpe

    CorAWR

    AAna

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    42/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.42

    Preventive Performance Management

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    43/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.43

    Preventive Performance Management

    Prevent Regression AfterUpgrade

    Ensure Optimal ResourceAllocation

    Prevent Performance IssuesDue to Application Changes

    Case

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    44/56

    DATABASE MANAGEMENT187 Million Members$252 Million in Revenue800 Oracle Databases1,400 Applications

    Preventiv

    Challenge: LinkedIns ERP systems were being upgraded from

    DB 10g to DB11g Presence of a large amount of custom code Limited time frame to complete the upgrade. Management concern about System performance Initial testing showed no major problems/concerns

    A week before go-live several potentialshowstopper performance issues were noticed. Re-writing or tuning several pieces of code was not

    feasible in a short window of time. Decision to use either SQL Profiles or Baselines to

    regress to the DB10g plan in the interim

    Using Oracle Enterprise Ma Used EM to regress back to thejob that calls the slow performin

    Used SQL Tuning Advisor to drsession and identify the SQL ID

    You can compare the explain pexplain plan in the same windo

    Click through guided wizard to profile

    DONE!!!

    SQL Tuning Advisor

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    45/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1345

    Comprehensive SQL Tuning Recom

    Gather Missing or StaleStatistics

    Create a SQL Profile

    Add Missing AccessStructures

    Modify SQL Constructs

    Adopt AlternativeExecution Plan (11.2)

    Create Parallel SQLProfile (11.2)

    SQL Profiling

    Statistics Analysis

    Access Path Analysis

    SQL Restructure Analysis

    Alternative Plan Analysis

    Parallel Query Analysis

    Automatic Tuning Optimizer

    SQL TuningAdvisor

    Analyzes statistics for accuracy Recommends SQL Profiles for transparent application tuning

    Suggest access structures and alternate SQL to speed up query exe

    Identifies alternative execution plans using real-time and historical pedata to recover from plan regression

    Recommends appropriate degree of parallelism for best performance

    Preventive Performance Management

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    46/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.46

    Preventive Performance Management

    Prevent Regression AfterUpgrade

    Ensure Optimal ResourceAllocation

    Prevent Performance IssuesDue to Application Changes

    SQ

    Ensure Optimal Resource Allocation

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    47/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.47

    We are going through a schema consolidation,how can I ensure one schema / user will not

    run away with all my system resources?

    Database resource manager directives preventa single user session to run away with allresources

    Create a resource allocation strategy Allocate appropriate CPU and I/O (Exadata)

    across consumer groups

    Allocating Resources in the Database

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    48/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.48

    g

    Gives maximum flexibility for each Consumer Group Allows any Consumer Group to consume all available Risky as one Consumer Group can run away with al

    No ResourceAllocation

    Ensures all Consumer Group get a specific share of t Allows any Consumer Group to consume any unused Kicks in at 100% resource utilization. Assumes that not all Consumer Group will use its allo

    Specify a minimumallocation

    Ensures all Consumer Group get a specific share of t Prevents a Consumer Group from taking more than t

    assigned. May result in unused capacity

    Specify a minimumand maximum

    Tip: Setting up Resource Manager in Oracle Ent

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    49/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.49

    Manager

    Extremely simple to manage resource plans using EnterprManager UI

    Preventive Performance Management

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    50/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.50

    e e t e e o a ce a age e t

    Prevent Regression AfterUpgrade

    Ensure Optimal ResourceAllocation

    Prevent Performance IssuesDue to Application Changes

    SQ

    DB

    Prevent Performance Issues Due toApplication Changes

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    51/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.51

    Application Changes

    The new BI system has very aggressive SLAsdefined. How can we ensure consistentperformance across the system?

    Code migration, new indices, objects can oftenimpact performance of the application

    How do we validate the performance of criticalqueries before rolling out these changes ?

    Validate

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    52/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.52

    Trial 1

    01001011001010100100100100100100100100100100100010010101001001001001110010010010010010010000100100000101110010010101001001001010101001000100000101010010010101010011010100101010010010101001100101

    Impact of Custom Code Migration

    Use SPA Guided Workflow (recommended) or PL/SQL APIs

    Create a SQL tuning set of the top X (20 or 30) queries

    Establish first trial remotely using current state baseline

    Make change Create the indexes or migrate custom code

    Establish second trial remotely using the same SQL Tuning Set

    Review SPA report and rollout or rollback changes.

    Trial 2

    Central SPA System Production

    State 1

    State 2

    Tip: Take the Guess Work Out!

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    53/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.53

    Rube

    mich

    Mamoqu

    reg Ta

    wo

    Preventive Performance Management

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    54/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved.54

    g

    Prevent Regression AfterUpgrade

    Ensure Optimal ResourceAllocation

    Prevent Performance IssuesDue to Application Changes

    SQ

    D

    FINAL Tip: Use Oracle Database Management TecSo You Can

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    55/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1355

    So You Can

    Manage:

    MORE databases

    MOREapplications: OLTP, DW, OCS, iAS, SaaS, DBaaS MOREusers, larger databases

    MOREmission-critical applications

    Become:

    MOREproactive and strategic

    MORE important and valuableGet:

    MORE sleep at night!

    MORE weekends off!

  • 7/30/2019 Maximize Db Performance Top10 Tips Final

    56/56

    Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1656