JobPlus知识库 IT 基础架构 文章
sql优化小工具之SQLHC

SQLHC 是什么东西呢,全称:SQL Tuning Health-Check Script 是 Oracle Server Technologies Center of Expertise 开发的一个工具。该工具也被称为 SQLHC,用于检查单条 SQL 语句运行的环境,包括基于成本的优化器(CBO)的统计数据,用户对象的元数据定义,配置参数和其他可能影响到待分析 SQL 性能的因素。

脚本信息描述:

点击(此处)折叠或打开

  1. Produces an HTML report with a list of observations based on
  2. health-checks performed in and around a SQL statement that
  3. may be performing poorly.

执行条件:

点击(此处)折叠或打开

  1. 1. Execute as SYS or user with DBA role or user with access
  2.     to data dictionary views.
  3.  2. The SQL for which this script is executed must be
  4.     memory-resident.

参数说明:
点击(此处)折叠或打开

  1. 1. Oracle Pack license (Tuning or Diagnostics or None) T|D|N
  2.  2. SQL_ID of interest.

执行命令(参考) 输入相关SQL_ID:
点击(此处)折叠或打开

  1. REM # sqlplus / as sysdba
  2. REM SQL> START [path]sqlhc.sql [T|D|N] [SQL_ID]
  3. REM SQL> START sqlhc.sql T 51x6yr9ym5hdc


执行完成会生成一个ZIP包,类似以下名字

点击(此处)折叠或打开

  1. sqlhc_20170716_155643_7b2twsn8vgfsc.zip


里边有健康检查、诊断、sql 执行计划等相关信息,格式为HTML,还有一些日志。 有兴趣的可以自己执行以下试试。


如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

¥ 打赏支持
316人赞 举报
分享到
用户评价(0)

暂无评价,你也可以发布评价哦:)

扫码APP

扫描使用APP

扫码使用

扫描使用小程序