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

勤奋不是嘴上说说而已,而是实际的行动,在勤奋的苦度中持之以恒,永不退却。业精于勤,荒于嬉;行成于思,毁于随。在人生的仕途上,我们毫不迟疑地选择勤奋,她是几乎于世界上一切成就的催产婆。只要我们拥着勤奋去思考,拥着勤奋的手去耕耘,用抱勤奋的心去对待工作,浪迹红尘而坚韧不拔,那么,我们的生命就会绽放火花,让人生的时光更加的闪亮而精彩。

导读:本篇文章讲解 SQL调优和诊断神器SQLTXPLAIN (SQLT)简介(二 XPLORE Module),希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/141611.html

(0)
飞熊的头像飞熊bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!