Upload
mabu-dba
View
227
Download
0
Embed Size (px)
Citation preview
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
1/28
SQL Tuning made easier with SQLTXPLAIN
Carlos Sierra
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
2/28
!"#$%& ()*##"
+,-).*/ !%,&0$.",. 1#"/$* 2*#3%#4",/* (56 70,),8 269(56
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
3/28
Agenda
! Introduction! Installation!
Main methods XTRACT, XECUTE and XTRXEC XTRSBY and XPLAIN XPREXT and XPREXC
! Main HTML diagnostics report
SQL Tuning made easier with SQLTXPLAIN (SQLT)
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
4/28
SQLTXPLAIN (SQLT)
Introduction
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
5/28
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
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
6/28
SQLTXPLAIN (SQLT) benefits
! Collect SQL tuning diagnostics for one SQL statement! Over a hundred health-checks (HC) around the SQL statement! If Oracle Tuning or Diagnostics Pack are properly licensed
Invokes SQL Tuning Advisor (STA) Includes Active Session History (ASH) and SQL Monitor Report 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?
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
7/28
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 them!
How does it work?
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
8/28
SQLT Installation
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
9/28
How do I install SQLT?
! Download tool (sqlt.zipfile)! Unzip into database server! Execute sqlt/install/sqcreate.sql
connected as SYS
! Input installation parameters
My Oracle Support (MOS) 215187.1
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
10/28
SQLT Installation Parameters
! Optional Connect Identifier (ie: @PROD)! Password for user SQLTXPLAIN! Default Tablespace! Temporary Tablespace! Main application user of SQLT! Oracle Pack license [ T | D | N ]
Provided inline or when asked
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
11/28
How do you know Installation succeeded?
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
12/28
How do I uninstall SQLT
! Execute sqlt/install/sqdrop.sqlconnected as SYSIn case you no longer need SQLT
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
13/28
SQLT Main Methods
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
14/28
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_ROLE granted! Password for SQLTXPLAIN must be provided! One SQL per use of SQLT! SQLT has its own configuration parameters
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
15/28
Using SQLT Main MethodsMethod Script Features
SQLTXTRACT sqlt/run/sqltxtract.sql "Most common method"Inputs SQL_ID"SQL statement is not executed
SQLTXECUTE sqlt/run/sqltxecute.sql "Inputs a script name which contains#ALTER SESSION commands (if applicable)#
Binds declaration and assignment (if applicable)#SQL statement
"Executes the SQL statementSQLT XTRXEC sqlt/run/sqltxtrxecsql "Combines XTRACT and XECUTE
"Inputs SQL_IDSQLT XPLAIN sqlt/run/sqltxplain.sql "Inputs a file name which contains a SQL statement
"What if SQL contains binds?"Leave them in place, OR Replace with literals of same data type
SQLT XTRSBY sqlt/run/sqltxtrsby.sql "For read-only databases"Executes in Primary and connects into stand-by"Works like XTRACT"Inputs SQL_ID and DBLINK
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
16/28
!XTRXECincludesXTRACT and XECUTE
XPLAIN
XTRSBY
CommonXTRACT
XECUTE
SQLT Output Overlap
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
17/28
SQLT Main HTML
Diagnostics Report
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
18/28
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)
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
19/28
What is included in Main Report?
! Plan stability!Active Session History (ASH)! SQL performance metrics! SQL Monitor! Segment and session statistics! Tables
Partial list of contents (2/3)
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
20/28
What is included in Main Report?
! Indexes! CBO statistics! Objects and dependencies! Policies! Metadata
Partial list of contents (3/3)
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
21/28
Navigating the SQLT Main Report
1. SQL Text2. Plans Summary3. Observations4. Branch as per findings
Typical Navigation
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
22/28
DemonstrationMain Report Navigation
! SQLT XTRACT! SQLT XECUTE
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
23/28
Summary
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
24/28
SQL Tuning made easier with SQLTXPLAINHow is that?
! Full collection of SQL tuning diagnostics Consolidated into an easy-to-navigate html report Consistent view Allow offlineexpert analysis
! Over a hundred health-checks around the SQL statement 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
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
25/28
Want to master SQLTXPLAIN?Book: Oracle SQL Tuning with Oracle SQLTXPLAIN
!Author: Stelios Charalambides! Released: March 20, 2013! Level: Intermediate!Available
!Apress!Amazon! Barnes&Noble
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
26/28
Eager to master SQL Tuning?
! Jonathan Lewis! Maria Colgan! Tom Kyte! Kerry Osborne! Cary Millsap! Christian Antognini! Guy Harrison! Karen Morton
Some SQL Tuning Gurus (Google them!)
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
27/28
My Oracle Support Notes and Contact Info
! 215187.1SQLTXPLAIN (SQLT) Tool Download! 1454160.1 SQLTXPLAIN (SQLT) FAQ
MOS (Metalink) Notes
! [email protected]! http://carlos-sierra.net! @csierra_usa
8/14/2019 SQL Tuning made easier with SQLTXPLAIN.pptx.pdf
28/28