SQL性能的度量 - 利用Hints和dbms_sqltune进行SQL监控

可以使用Hints对某个SQL开启实时监控

select /*+monitor*/ count(*) from scott.emp where sal>2000;


使用dbms_sqltune查看监控信息

set long 9999999

set longchunksize 9999999

set linesize 200

select dbms_sqltune.report_sql_monitor from dual;


REPORT_SQL_MONITOR

---------------------------------------------------------------------------------------------------------------------------

SQL Monitoring Report


SQL Text

------------------------------

select /*+monitor*/ count(*) from scott.emp where sal>2000


Global Information

------------------------------

 Status              :  DONE (ALL ROWS)

 Instance ID         :  1

 Session             :  SYS (9:15084)

 SQL ID              :  6k8qh0ubz4mnw

 SQL Execution ID    :  16777216

 Execution Started   :  05/27/2017 23:10:31

 First Refresh Time  :  05/27/2017 23:10:31

 Last Refresh Time   :  05/27/2017 23:10:31

 Duration            :  .0003s

 Module/Action       :  sqlplus.exe/-

 Service             :  SYS$USERS

 Program             :  sqlplus.exe

 Fetch Calls         :  1


Global Stats

==================================================

| Elapsed |    IO    |  Other   | Fetch | Buffer |

| Time(s) | Waits(s) | Waits(s) | Calls |  Gets  |

==================================================

|    0.00 |     0.00 |     0.00 |     1 |      7 |

==================================================


SQL Plan Monitoring Details (Plan Hash Value=2083865914)

==========================================================================================================================

| Id |      Operation       | Name |  Rows   | Cost |   Time    | Start  | Execs |   Rows   | Activity | Activity Detail |

|    |                      |      | (Estim) |      | Active(s) | Active |       | (Actual) |   (%)    |   (# samples)   |

==========================================================================================================================

|  0 | SELECT STATEMENT     |      |         |      |         1 |     +0 |     1 |        1 |          |                 |

|  1 |   SORT AGGREGATE     |      |       1 |      |         1 |     +0 |     1 |        1 |          |                 |

|  2 |    TABLE ACCESS FULL | EMP  |      10 |    3 |         1 |     +0 |     1 |        6 |          |                 |

==========================================================================================================================


监控信息始终指向最后一次监控的SQL语句,这些信息将会在数据库重启后清除。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28974745/viewspace-2150351/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28974745/viewspace-2150351/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值