sql tuning made much easier with sqltxplain sqlt v0

Upload: srinivas-kankanampati

Post on 14-Apr-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    1/29

    Copyright 2013, Oracle and/or its affiliates.1

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    2/29

    Copyright 2013, Oracle and/or its affiliates.2

    SQL Tuning made much easierwith SQLTXPLAIN (SQLT)

    Carlos SierraConsulting Technical Advisor

    Center of Expertise (CoE)

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    3/29

    Copyright 2013, Oracle and/or its affiliates.3

    Carlos Sierra

    SQL Tuner handyman: developer, advisor, trainer, supp

    IT: Oracle(17), UNISYS(12), Ford(3), others(3)

    Florida(17), Venezuela(3), Puerto Rico(6), Michigan(1),

    Tools: SQLTXPLAIN(SQLT), SQLHC, TRCANLZR(TRC

    Motto: Life is good!

    Oracle Server Technologies(ST) Center of Expertise(CoE)

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    4/29

    Copyright 2013, Oracle and/or its affiliates.4

    Agenda

    Introduction

    Installation

    Main methods

    XTRACT, XECUTE and XTRXEC

    XTRSBY and XPLAIN

    XPREXT and XPREXC

    Main HTML diagnostics report

    SQL Tuning made much easier with SQLTXPLAIN (SQLT)

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    5/29Copyright 2013, Oracle and/or its affiliates.5

    SQLTXPLAIN (SQLT)Introduction

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    6/29Copyright 2013, Oracle and/or its affiliates.6

    What is SQLTXPLAIN (SQLT)?

    Add-on (MOS 215187.1) 11g/10g

    Linux, UNIX, Windows

    Single instance, RAC, Exadata

    Easy to install and execute

    download and use

    Tool to diagnose SQL statements performing poorly

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    7/29

    Copyright 2013, Oracle and/or its affiliates.7

    SQLTXPLAIN (SQLT) benefits

    Collect SQL tuning diagnostics for one SQL statement Over a hundred health-checks (HC) around the SQL sta

    If Oracle Tuning or Diagnostics Pack are properly licens

    Invokes SQL Tuning Advisor (STA)

    Includes Active Session History (ASH) and SQL Monitor R

    Includes Automatic Workload Repository (AWR)

    Automatic SQL tuning test case (TC) extraction

    SQLT helps to expedite SQL tuning process

    What is in it for me?

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    8/29

    Copyright 2013, Oracle and/or its affiliates.8

    SQLTXPLAIN (SQLT) mechanics

    3 + 4 main methods to analyze one SQL statement

    Inputs one SQL statement and outputs one zip file

    Output contains a main html report and other files

    AWR, ADDM, ASH, 10053, 10046, TKPROF, etc.

    Exports SQL tuning test cases SQLT TC and TCX

    11g Test Case Builder (TCB)

    SQLT installs its own two schemas and objects on th

    How does it work?

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    9/29

    Copyright 2013, Oracle and/or its affiliates.9

    SQLT Installation

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    10/29

    Copyright 2013, Oracle and/or its affiliates.10

    How do I install SQLT?

    Download tool (sqlt.zip file)

    Unzip into database server

    Execute sqlt/install/sqcreate.sql

    connected as SYS

    Input installation parameters

    My Oracle Support (MOS) 215187.1

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    11/29

    Copyright 2013, Oracle and/or its affiliates.11

    SQLT Installation Parameters

    Optional Connect Identifier

    Password for user SQLTXP

    Default Tablespace

    Temporary Tablespace

    Main application user of SQ Oracle Pack license [ T | D

    Provided inline or when aske

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    12/29

    Copyright 2013, Oracle and/or its affiliates.12

    How do you know Installation succeed

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    13/29

    Copyright 2013, Oracle and/or its affiliates.13

    How do I uninstall SQLT

    Execute sqlt/install/sqdrop.sql connected as SYS

    In case you no longer need SQLT

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    14/29

    Copyright 2013, Oracle and/or its affiliates.14

    SQLT Main Methods

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    15/29

    Copyright 2013, Oracle and/or its affiliates.15

    SQLT Main Methods

    SQLT XTRACT

    SQLT XECUTE

    SQLT XTRXEC

    SQLT XPLAIN

    SQLT XTRSBY SQLT XPREXT

    SQLT XPREXC

    All 3 + 2 + 2 act on one SQL statement

    All methods have these requirements

    SQL*Plus connecting as application user

    Application user must have SQLT_USER_

    Password for SQLTXPLAIN must be prov

    One SQL per use of SQLT

    SQLT has its own configuration paramete

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    16/29

    Copyright 2013, Oracle and/or its affiliates.16

    Using SQLT Main Methods

    Method Script Features

    SQLTXTRACT sqlt/run/sqltxtract.sql Most common methodInputs SQL_ID

    SQL statement is not executed

    SQLTXECUTE sqlt/run/sqltxecute.sql Inputs a script name which containsALTER SESSION commands (if applicabl

    Binds declaration and assignment (if appli

    SQL statement

    Executes the SQL statement

    SQLT XTRXEC sqlt/run/sqltxtrxecsql Combines XTRACT and XECUTEInputs SQL_ID

    SQLT XPLAIN sqlt/run/sqltxplain.sql

    Inputs a file name which contains a SQL statemeWhat if SQL contains binds?

    Leave them in place, OR Replace with literals of s

    SQLT XTRSBY sqlt/run/sqltxtrsby.sql For read-only databasesExecutes in Primary and connects into stand-by

    Works like XTRACT

    Inputs SQL_ID and DBLINK

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    17/29

    Copyright 2013, Oracle and/or its affiliates.17

    XTRXEC includes

    XTRACT and XECUTE

    XPLAIN

    XTRSBY

    CommonXTRACT

    XECUTE

    SQLT Output Overlap

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    18/29

    Copyright 2013, Oracle and/or its affiliates.18

    SQLT Main HTML

    Diagnostics Report

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    19/29

    Copyright 2013, Oracle and/or its affiliates.19

    What is included in Main Report?

    Health-checks SQL text

    Parameters

    Cursor sharing

    SQL Tuning Advisor (STA) report Execution plans

    Partial list of contents (1/3)

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    20/29

    Copyright 2013, Oracle and/or its affiliates.20

    What is included in Main Report?

    Plan stabilityActive Session History (ASH)

    SQL performance metrics

    SQL Monitor

    Segment and session statistics Tables

    Partial list of contents (2/3)

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    21/29

    Copyright 2013, Oracle and/or its affiliates.21

    What is included in Main Report?

    Indexes CBO statistics

    Objects and dependencies

    Policies

    Metadata

    Partial list of contents (3/3)

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    22/29

    Copyright 2013, Oracle and/or its affiliates.22

    Navigating the SQLT Main Report

    1. SQL Text2. Plans Summary

    3. Observations

    4. Branch as per findings

    Typical Navigation

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    23/29

    Copyright 2013, Oracle and/or its affiliates.23

    Demonstration

    Main Report Navigation

    SQLT XTRACT SQLT XECUTE

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    24/29

    Copyright 2013, Oracle and/or its affiliates.24

    Sum

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    25/29

    Copyright 2013, Oracle and/or its affiliates.25

    SQL Tuning made easier with SQLTXPLAIN

    Full collection of SQL tuning diagnostics

    Consolidated into an easy-to-navigate html report

    Consistent view

    Allow offline expert analysis

    Over a hundred health-checks around the SQL statemen

    Some with pointers to particular notes or bugs

    Automatic SQL tuning test case (TC) extraction

    Allow WHAT-IF evaluations on a test environment

    Dynamic readme with commands for further diagnostics

    How is that?

    W t t t SQLTXPLAIN?

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    26/29

    Copyright 2013, Oracle and/or its affiliates.26

    Want to master SQLTXPLAIN?

    Book: Oracle SQL Tuning with Oracle SQLTXPLAIN

    Author: Stelios Charalambides Released: March 20, 2013

    Level: Intermediate

    Available

    ApressAmazon

    Barnes&Noble

    E t t SQL T i ?

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    27/29

    Copyright 2013, Oracle and/or its affiliates.27

    Eager to master SQL Tuning?

    Jonathan Lewis Maria Colgan

    Tom Kyte

    Wolfgang Breitling

    Cary Millsap

    Christian Antognini

    Guy Harrison

    Karen Morton

    Some SQL Tuning Gurus (Google them!)

    M O l S t N t d C t t

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    28/29

    Copyright 2013, Oracle and/or its affiliates.28

    My Oracle Support Notes and Contact

    215187.1 SQLTXPLAIN (SQLT) Tool Download 1454160.1 SQLTXPLAIN (SQLT) FAQ

    MOS (Metalink) Notes

    carlos.sierra@ora

    http://carlos-sierra

    @csierra_usa

  • 7/30/2019 SQL Tuning Made Much Easier With Sqltxplain Sqlt v0

    29/29

    Copyright 2013, Oracle and/or its affiliates.29