SQL调优和诊断神器SQLTXPLAIN (SQLT)简介(二 XPLORE Module)

XPLORE Module

对于SQL的很多Optimzer问题如执行计划异常、SQL慢、结果不正(Wrong Result)等,
如果在测试环境可以重现的话,可以通过SQLT的xplore功能,
调整各种参数和Optimzer的Fix Control来找到回避方法和找到Root Cause。

其他参考:
【SQL工具】SQL调优和诊断神器SQLTXPLAIN (SQLT)简介

注意点

在使用xplore功能时需要注意以下几点:

Use XPLORE only when ALL these conditions are met:
    SQL performs poorly or returns wrong results while using a "bad" plan.
    The bad plan can be reproduced on a test system (no data is preferred).
    A "good" plan can be reproduced on the test system by switching OFE.
    You need to narrow reason to specific parameter or bug fix control.
    You have full access to the test system, including SYS access.
Do not use XPLORE when ANY of these conditions is true:
    The SQL statement may cause corruption or update data.
    There is high volume of data in tables referenced by SQL.
    The execution of the SQL may take longer than a few seconds.

执行例

以下是xplore的执行方法例:

SQL*Plus: Release 12.2.0.1.0 Production on Sun May 21 03:16:55 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> START install.sql
Test Case User: testxplore
Password: testxplore
...
Installation completed.
You are now connected as testxplore.
1. Set CBO env if needed
2. Execute @create_xplore_script.sql
SQL> @create_xplore_script.sql
Parameter 1:
XPLORE Method: XECUTE (default) or XPLAIN
"XECUTE" requires /* ^^unique_id */ token in SQL
"XPLAIN" uses "EXPLAIN PLAN FOR" command
Remember EXPLAIN PLAN FOR does not perform bind peeking
Enter "XPLORE Method" [XECUTE]: XECUTE
Parameter 2:
Include CBO Parameters: Y (default) or N
Enter "CBO Parameters" [Y]:
Parameter 3:
Include Exadata Parameters: Y (default) or N
Enter "EXADATA Parameters" [Y]: N
Parameter 4:
Include Fix Control: Y (default) or N
Enter "Fix Control" [Y]: Y
Parameter 5:
Generate SQL Monitor Reports: N (default) or Y
Only applicable when XPLORE Method is XECUTE
Enter "SQL Monitor" [N]: Y
...
Review and execute @xplore_script_1.sql

※在执行前你需要建立一个包括/* ^^unique_id */的对象SQL文件如test.sql,
然后执行plore_script_1.sql
例:
test.sql
SELECT /* ^^unique_id */ …

执行:
SQL>@xplore_script_1.sql
testxplore
Parameter 1:
Name of SCRIPT file that contains SQL to be xplored (required)
Note: SCRIPT must contain comment /* ^^unique_id */
Enter value for 1: test.sql
Parameter 2:
Password for testxplore (required)
Enter value for 2: testxplore

版权声明:本文为博主原创文章,转载必须注明出处,本人保留一切相关权力!http://blog.csdn.net/lukeunique

欢迎关注微信订阅号:Oracle数据库技术 (TeacherWhat)
这里写图片描述

参考:

sqlt/utl/xplore/readme.txt

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SQLplusDB

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值