Oracle 11g 比10046更直观的工具DBMS_SQLTUNE

来源:互联网 发布:php供求发布系统源码 编辑:程序博客网 时间:2024/05/17 07:28
   比起10046,它的优势是图像化界面更加友好,可以看到每一步占用的CPU,IO的等待时间及大小,特别是并行的执行计划10046会生成太多的文件,不好分析,它只生成一个。
The real-time SQL monitoring feature of Oracle Database enables you to monitor the performance of SQL statements while they are executing. By default, SQL monitoring automatically starts when a SQL statement runs parallel, or when it has consumed at least 5 seconds of CPU or I/O time in a single execution.
SQL以并行方式或者单独运行占用CPU或IO的时间超过5秒钟就会自动被ORACLE启用监视。

如果没有权限执行DBMS_SQLTUNE,则需要赋予用户ADVISOR权限
grant ADVISOR  to test;

要想看report,需要查询是否在gv$sql_monitor中是否存在。
select * from gv$sql_monitor s where s.SQL_ID='3m43vtkhgh83u';

set pages 0  echo off timing off linesize 1000 trimspool on  trim on long 2000000   feedback off
spool d:/453hh5f98kzqw.html
SELECT DBMS_SQLTUNE.report_sql_monitor(
  type=> 'active',
  sql_id=> '453hh5f98kzqw',
  sql_exec_id=>null,
  report_level=> 'ALL'
  )  monitor_report  FROM dual;
SPOOL OFF

注意:要想分析生成的文件必须得连上网络。
阅读全文
0 0