4. 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
5. 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
6. 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
7. 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
8. 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
9. XPLORE
HTML
Report
•
•
•
•
•
Plans
Summary
Discovered
Plans
Baseline
Completed
Tests
for
each
Plan
ExecuDon
Plans
11/12/13
Enkitec
(c)
9
10. 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
12. 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
13. 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
14. 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
15. 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
16. 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
17. Uninstalling
XPLORE
• Execute
sqlt/utl/xplore/uninstall.sql
as
SYS
• Provide
test
case
user
when
asked
11/12/13
Enkitec
(c)
17
18. 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
19. 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
20. 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