Sunteți pe pagina 1din 56

Maximize Oracle Database Performance with Oracle Enterprise Manager 12c:

Top 10 Tips & Tricks

Scott McNeil Principal Product Director, Oracle


Deba Chatterjee Principal Product Manager, Oracle

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

Insert Information Protection Policy Classification from Slide 13

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, what happened?
9. We are going through a schema consolidation, how can I ensure one session will not run away with all my system resources? 10. The new BI system has very aggressive SLAs defined. How can we ensure consistent performance across the system?

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

Insert Information Protection Policy Classification from Slide 13

3 Types of Performance Management


Reactive Performance Management Proactive Performance Management Preventive Performance Management

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

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

Reactive Performance Management


Comparing Performance Across Two Time Periods Database Hang Analysis

SQL Performance Analysis I

SQL Performance Analysis -II

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

Comparing Performance Across Two Periods


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

Over utilization of system resources High load ad hoc query consuming resources Change in execution plan of query Parallel execution downgrade

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

Tip: Compare Period ADDM


SQL Commonality

AWR Snapshot Period 1

Regressed SQL

I/O Bound

AWR Snapshot Period 2

Compare Period ADDM

Analysis Report

Undersized SGA

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


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

Compare Period ADDM: Method


Identify what changed Configuration changes, workload changes
Quantify performance differences Uses DB Time as basis for measuring performance Identify root cause Correlate performance differences with changes
30% smaller Buffer cache

10% new SQL

Top SQL increased 45%


Read I/O up 55%

Buffer cache reduction caused read I/O increase

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

Reactive Performance Management


Comparing Performance Across Two Time Periods
Database Hang Analysis
Compare Period ADDM

SQL Performance Analysis I


SQL Performance Analysis II

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

Database Hang Analysis


My database is hung? I do not want to bounce it.
Database Hung state

Blocking Sessions Memory allocation issues Library cache issues Unresponsive Storage (ASM) Interconnect problems
10
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Tip: Real-Time ADDM


EM Agent
Deadlocks

Diagnostic Connection

Unresponsive DB
JDBC Connection

Hangs

Latches

Real-Time Analysis
Database

ADDM Analysis

Uses a pre-established diagnostic connection for unresponsive systems Initiates a standard JDBC connection for real-time analysis Diagnostic connection collects data without holding latches or running SQL First intelligent advisor to diagnose problems in real-time as they occur, no matter how sick the system is
11
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Real-Time ADDM


12

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
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Reactive Performance Management


Comparing Performance Across Two Time Periods
Database Hang Analysis SQL Performance Analysis I SQL Performance Analysis II
Compare Period ADDM

Real-Time ADDM

13

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

SQL Performance Analysis


I enabled parallel query, yet this query is taking

so long. Can you take a look?


Parallel Downgrades
Uncontrolled parallel execution Parallel Server availability Object level settings Session level settings

14

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

Tip: Real-Time SQL Monitoring


Insert Executed with Parallel Hint

15

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

Real-Time SQL Monitoring


Parallel Tab

Parallel Coordinator busy for the entire duration!!


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

Real-Time SQL Monitoring


Enabled Parallel DML

Parallel Slaves busy for the entire duration!!!


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

SQL Performance Analysis


My simple query takes so long. Whats wrong

with the database?


SQL Performance Problems
Statistics
Resources Application issues

Parallelism
Initialization parameters

18

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

Tip: Real-Time SQL Monitoring


SQL with Count and Group By

19

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

Real-Time SQL Monitoring


SQL with Count and Group By

20

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

Real-Time SQL Monitoring


PGA Size Increased

21

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

Reactive Performance Management


Comparing Performance Across Two Time Periods
Database Hang Analysis SQL Performance Analysis I SQL Performance Analysis II
Compare Period ADDM

Real-Time ADDM

SQL Monitoring

22

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

23

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

Proactive Performance Management


Dealing with run away queries

Understanding Workload Profile I

Understanding Workload Profile II

24

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

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

Real-time SQL Monitoring introduced in DB 11g


Monitors long-running and parallel query (PQ) SQL executions
Rich interactive user interface and Active Report

GV$SQL_MONITOR
Not really intended for user-written queries

25

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

What are Oracle Enterprise Manager 12c Metric Extensions?


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

26

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

Design Metric Extension


GV$SQL_MONITOR

query
SQL_ID: key column TotalCPUSecs TotalElapsedSecs Execute every 15-minutes

(to not miss anything)


Set alert thresholds on

CPU and Elapsed times

27

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

Find Metric Extensions

28

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

Manage Metric Extensions

29

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

Create Metric Extension


Guided wizard makes it

easy
Well organized Excellent

explanations
Develop and test on

any database before deploying to production

30

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

Monitoring
Email notification with

custom subject line


Informative email with

context-sensitive hyperlinks into EM


Your metric is a first-

class EM metric

31

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

Proactive Performance Management


Run away queries

Metric Extensions

Understanding Workload Profile I

Understanding Workload Profile II

32

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

Understanding Workload Profile


What happened last night, the batch job took

twice 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

33

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

Insert Information Protection Policy Classification from Slide 13

Database Response Time AnalysisAWR


AWR top 5 section shows the Wait Class which contributes most to DB wait time

Foreground Wait Class section in AWR to see distribution of DB waits over Waits classes

Objects involved in TX row lock contention can be identified in Segment Statistics section of AWR

34

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

Insert Information Protection Policy Classification from Slide 13

From AWR to ASH


ASH report for the period of increase of Application waits will show the same waits as AWR

Can I get the Application Module which suffered from this type of contention ?

35

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

Insert Information Protection Policy Classification from Slide 13

Extracting More Data From ASH


Identify SQL statements and sessions impacted by waits on

Application Wait Class

36

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

Insert Information Protection Policy Classification from Slide 13

Extracting More Data From ASH


Get a list of blocking sessions and DB objects !

37

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

Insert Information Protection Policy Classification from Slide 13

Proactive Performance Management


Reactive Tracing of Long Running Programs

Database Operations
Correlate AWR & ASH

Understanding Workload Profile - I

Understanding Workload Profile - II

38

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

Insert Information Protection Policy Classification from Slide 13

Understanding Workload Profile


The SQL Response Metric crossed the warning

threshold. 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-memory

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

Tip: Understanding Workload Profile

Graphical ASH report for advanced analysis

Different visualizations: Stacked chart or Tree Map Provides visual filtering for recursive drill-downs Collaborate with others using Active Select any time period for analysis Reports Analyze performance across many dimensions
40
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Proactive Performance Management


Reactive Tracing of Long Running Programs

Database Operations
Correlate AWR & ASH

Understanding Workload Profile - I

Understanding Workload Profile - II

ASH Analytics

41

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

42

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

Preventive Performance Management


Prevent Regression After Upgrade

Ensure Optimal Resource Allocation


Prevent Performance Issues Due to Application Changes
43
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Case Study
DATABASE MANAGEMENT
187 Million Members $252 Million in Revenue 800 Oracle Databases 1,400 Applications

FOCUS ON Preventive Performance Management

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 potential showstopper 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 Manager:


Used EM to regress back to the old plan to run a job that calls the slow performing SQL Used SQL Tuning Advisor to drilling down in to the session and identify the SQL ID You can compare the explain plan and see the new explain plan in the same window Click through guided wizard to implement the SQL profile DONE!!!

SQL Tuning Advisor


Gather Missing or Stale Statistics Create a SQL Profile

SQL Profiling Statistics Analysis Access Path Analysis SQL Restructure Analysis

Add Missing Access Structures Modify SQL Constructs Adopt Alternative Execution Plan (11.2) Create Parallel SQL Profile (11.2)

Alternative Plan Analysis


Parallel Query Analysis

SQL Tuning Advisor

Administrator

Automatic Tuning Optimizer

Comprehensive SQL Tuning Recommendations

Analyzes statistics for accuracy Recommends SQL Profiles for transparent application tuning Suggest access structures and alternate SQL to speed up query execution Identifies alternative execution plans using real-time and historical performance data to recover from plan regression Recommends appropriate degree of parallelism for best performance
45 Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Preventive Performance Management


Prevent Regression After Upgrade Ensure Optimal Resource Allocation Prevent Performance Issues Due to Application Changes
46
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

SQL Tuning Advisor

Ensure Optimal Resource Allocation


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 prevent

a single user session to run away with all resources Create a resource allocation strategy Allocate appropriate CPU and I/O (Exadata) across consumer groups

47

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

Allocating Resources in the Database


No Resource Allocation
Gives maximum flexibility for each Consumer Group Allows any Consumer Group to consume all available resource Risky as one Consumer Group can run away with all resources.

Specify a minimum allocation


Specify a minimum and maximum
48
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

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

Ensures all Consumer Group get a specific share of the resources Prevents a Consumer Group from taking more than the maximum value assigned. May result in unused capacity

Tip: Setting up Resource Manager in Oracle Enterprise Manager

Extremely simple to manage resource plans using Enterprise Manager UI


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

Preventive Performance Management


Prevent Regression After Upgrade Ensure Optimal Resource Allocation Prevent Performance Issues Due to Application Changes
50
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

SQL Tuning Advisor


DB Resource Manager

Prevent Performance Issues Due to Application Changes


The new BI system has very aggressive SLAs

defined. How can we ensure consistent performance across the system?


Code migration, new indices, objects can often

impact performance of the application How do we validate the performance of critical queries before rolling out these changes ?

51

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

Validate

Impact of Custom Code Migration


Central SPA System
Trial 1

Production

State 1
01001011001010100100100100100100100100100100100010010101001001001 00111001001001001001001000010010000010111001001010100100100101010 1001000100000101010010010101010011010100101010010010101001100101

Custom Code Changes

Trial 2

State 2


52

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.

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

Tip: Take the Guess Work Out!


Run your trial before and after migrating the change Make sure your most important queries are not regressed Take the guess work out

53

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

Preventive Performance Management


Prevent Regression After Upgrade Ensure Optimal Resource Allocation Prevent Performance Issues Due to Application Changes
54
Copyright 2012, Oracle and/or its affiliates. All rights reserved.

SQL Tuning Advisor


DB Resource Manager

SQL Performance Analyzer

FINAL Tip: Use Oracle Database Management Technologies So You Can


Manage: MORE databases MORE applications: OLTP, DW, OCS, iAS, SaaS, DBaaS MORE users, larger databases MORE mission-critical applications Become: MORE proactive and strategic MORE important and valuable Get: MORE sleep at night! MORE weekends off!
55 Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

56

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

Insert Information Protection Policy Classification from Slide 16

S-ar putea să vă placă și