Upload
enkitec
View
304
Download
4
Embed Size (px)
DESCRIPTION
Citation preview
SQLT XPLORE The SQLT XPLAIN Hidden Child
Carlos Sierra -‐ Enkitec
Carlos Sierra • Enkitec Consultant • Oracle Performance • SQL Tuning • PL/SQL
11/12/13 Enkitec (c) 2
SQLT XPLORE • IntroducDon • Input and Output • Screen Shots • Demo
11/12/13 Enkitec (c) 3
SQLTXPLAIN (SQLT) • Free SQL Tuning Tool • Oracle 10g to 12c • Linux/UNIX/Windows • Available @ MOS 215187.1 • Includes SQLT Test Case (TC) and XPLORE
11/12/13 Enkitec (c) 4
SQLT Test Case (TC) • Metadata to create a SQL Tuning test case – SQL Text with bind variables and their values – Schema Objects creaDon script – CBO StaDsDcs – Schema Objects mapping
11/12/13 Enkitec (c) 5
What is SQLT XPLORE? • Brute Force stand-‐alone module • Under sqlt/utl/xplore out of sqlt.zip • Acts on top of a SQLT TC – Or any SQL on a Test System
• Discovers several ExecuDon Plans
11/12/13 Enkitec (c) 6
XPLORE Mechanics • Iterates over – CBO Parameters and Fix Control
• For each iteraDon – Executes input SQL – Captures Plan
• Reports Summary 11/12/13 Enkitec (c) 7
XPLORE Input and Output • Inputs one script with one SQL • Outputs a zip with – HTML Report – SQL Monitor zip – Staging SQL Script – ExecuDon Log
11/12/13 Enkitec (c) 8
XPLORE HTML Report • Plans Summary • Discovered Plans • Baseline • Completed Tests for each Plan • ExecuDon Plans
11/12/13 Enkitec (c) 9
SQL Monitor ZIP • Only on 11g • Requires Oracle Tuning Pack – Controlled by XPLORE execuDon parameter
• You may need to embed /*+ MONITOR */ hint • One SQL Monitor Report for each iteraDon
11/12/13 Enkitec (c) 10
11/12/13 Enkitec (c) 11
When to use XPLORE? • SQL performance analysis – Afer a database sofware upgrade
• Bad Plan is reproducible on Test System • Good Plan can be obtained using OpDmizer Features Enabled (OFE) set to prior release
• You want to narrow reason of regression 11/12/13 Enkitec (c) 12
MulDple Uses • SQL Performance Regression afer Upgrade • Long Parse Time Analysis • Wrong Results Analysis – DiagnosDc of Query TransformaDons Errors
• Discover effect of “disabled” fixes • Find a beler performing Plan
11/12/13 Enkitec (c) 13
When NOT to use XPLORE? • When your SQL to be analyzed may corrupt or update data
• When using XPLORE with data and each iteraDon takes more than a few seconds
11/12/13 Enkitec (c) 14
XPLORE Prerequisites • Create a SQL Script with one SQL – Binds are allowed
• SQL on script must include /* ^^unique_id */ • Script must be capable to execute stand alone • SQL may or may not return rows – XPLORE works with and without data
11/12/13 Enkitec (c) 15
XPLORE InstallaDon • Place your input SQL Script into sqlt/utl/xplore • Execute sqlt/utl/xplore/install.sql as SYS • Input test case user and its password – XPLORE will be executed as test case user
11/12/13 Enkitec (c) 16
Uninstalling XPLORE • Execute sqlt/utl/xplore/uninstall.sql as SYS • Provide test case user when asked
11/12/13 Enkitec (c) 17
XPLORE use • Navigate to sqlt/utl/xplore/ • Connect as the test case user • Set the CBO environment (opDonal) • Execute create_xplore_script.sql • Execute dynamically generated xplore_script
11/12/13 Enkitec (c) 18
Create XPLORE Script Parameters • XPLORE Method: [ XECUTE | XPLAIN ] • Include CBO Parameters: [ Y | N ] • Include Exadata Parameters: [ Y | N ] • Include Fix Control: [ Y | N ] • Generate SQL Monitor Reports: [ N | Y ]
11/12/13 Enkitec (c) 19
XPLORE Script Parameters • Script to be executed on each iteraDon – Script must reside on sqlt/utl/xplore – Must contain /* ^^unique_id */ – Must be capable of stand-‐alone error-‐free exec
• Password for test case user – Each iteraDon re-‐connects and sets CBO env (opt)
11/12/13 Enkitec (c) 20
Input tc.sql Sample
11/12/13 Enkitec (c) 21
11/12/13 Enkitec (c) 22
11/12/13 Enkitec (c) 23
Input q1.sql Sample
11/12/13 Enkitec (c) 24
11/12/13 Enkitec (c) 25
11/12/13 Enkitec (c) 26
Input q2.sql Sample
11/12/13 Enkitec (c) 27
11/12/13 Enkitec (c) 28
11/12/13 Enkitec (c) 29
11/12/13 Enkitec (c) 30
Input q3.sql Sample
11/12/13 Enkitec (c) 31
11/12/13 Enkitec (c) 32
11/12/13 Enkitec (c) 33
Demo Time
11/12/13 Enkitec (c) 34
References • SQLTXPLAIN (SQLT) – MOS 215187.1
11/12/13 Enkitec (c) 35
Carlos Sierra Contact Info • [email protected]
• csierra_usa
• carlos-‐sierra.net
11/12/13 Enkitec (c) 36