1,首先确认两个参数的值

SQL> show parameter statistics_level

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
statistics_level             string     TYPICAL

SQL> SHOW PARAMETER control_management_pack_access

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
control_management_pack_access         string     DIAGNOSTIC+TUNING

2,从v$sql_monitor查看sql_id

SQL> select sql_id ,sql_text  from v$sql_monitor where sql_text like '%EMPLOYEE_TEST%';

SQL_ID
-------------
SQL_TEXT
--------------------------------------------------------------------------------
5ujtyb95f83jy
select /*+ parallel(8) */ * from scott.EMPLOYEE_TEST

2v0bzu74hyj30
select /*+ parallel(8) */ * from scott.EMPLOYEE_TEST where rownum<500

3,生成sql monitor报告
如果运行dbms_sqltune.report_sql_monitor报错说sqlmonitor组件不存在,要首先执行oracle/db/rdbms/admin/execrept.sql这个脚本。

SQL Monitor报告有三种格式 TEXT,HTML, ACTIVE

TEXT标准版

SET LONG 1000000
SET LONGCHUNKSIZE 1000000
SET LINESIZE 1000
SET PAGESIZE 0
SET TRIM ON
SET TRIMSPOOL ON
SET ECHO OFF
SET FEEDBACK OFF

SQL> SPOOL report_sql_monitor.txt

SQL> SELECT dbms_sqltune.report_sql_monitor(sql_id => '2v0bzu74hyj30',report_level => 'ALL',type=>'TEXT') comm FROM dual;
SQL Monitoring Report

SQL Text
------------------------------
select /*+ parallel(8) */ * from scott.EMPLOYEE_TEST where rownum<500

Global Information
------------------------------
Status          :    DONE (ALL ROWS)
Instance ID         :    1
Session         :    SYS (132:1717)
SQL ID          :    2v0bzu74hyj30
SQL Execution ID    :    16777216
Execution Started   :    09/22/2016 10:36:07
First Refresh Time  :    09/22/2016 10:36:07
Last Refresh Time   :    09/22/2016 10:36:07
Duration         :    .026675s
Module/Action         :    sqlplus@fff1 (TNS V1-V3)/-
Service         :    SYS$USERS
Program         :    sqlplus@fff1 (TNS V1-V3)
Fetch Calls         :    35

Global Stats
=========================================================================================
| Elapsed |   Cpu   |     IO    | Application |    Other    | Fetch | Buffer | Read | Read    |
| Time(s) | Time(s) | Waits(s) |  Waits(s)   | Waits(s) | Calls |  Gets  | Reqs | Bytes |
=========================================================================================
|    0.15 |    0.04 |      0.08 |    0.00 |       0.03 |    35 |    137 |   16 |  12MB |
=========================================================================================

Parallel Execution Details (DOP=8 , Servers Allocated=8)
Instances  : 2

=============================================================================================================================================
| Instance |      Name        | Type  | Server# | Elapsed |   Cpu   |    IO    | Application |  Other   | Buffer | Read | Read  | Wait Events |
|       |            |        |          | Time(s) | Time(s) | Waits(s) |    Waits(s)   | Waits(s) |  Gets  | Reqs | Bytes | (sample #)  |
=============================================================================================================================================
| 1       | PX Coordinator | QC    |          |    0.03 |    0.01 |         |          0.00 |     0.01 |     13 |      |     . |         |
| 2       | p004        | Set 1 |        1 |    0.02 |    0.00 |    0.01 |           |          |     13 |    2 |   2MB |         |
| 2       | p005        | Set 1 |        2 |    0.01 |    0.00 |    0.00 |           |          |     21 |    1 | 304KB |         |
| 2       | p006        | Set 1 |        3 |    0.02 |    0.00 |    0.01 |           |          |     30 |    3 |   2MB |         |
| 2       | p007        | Set 1 |        4 |    0.02 |    0.00 |    0.01 |           |          |     13 |    2 |   2MB |         |
| 1       | p004        | Set 1 |        5 |    0.02 |    0.00 |    0.01 |           |     0.01 |     13 |    2 |   2MB |         |
| 1       | p005        | Set 1 |        6 |    0.02 |    0.00 |    0.01 |           |     0.01 |      8 |    2 |   2MB |         |
| 1       | p006        | Set 1 |        7 |    0.02 |    0.00 |    0.01 |           |     0.00 |     13 |    2 |   1MB |         |
| 1       | p007        | Set 1 |        8 |    0.02 |    0.00 |    0.01 |           |          |     13 |    2 |   2MB |         |
=============================================================================================================================================

Instance Drill-Down
===================================================================================================================================
| Instance | Process Names        | Elapsed |   Cpu    |    IO    | Application |  Other   | Buffer | Read | Read  | Wait Events |
|       |                | Time(s) | Time(s) | Waits(s) |  Waits(s)     | Waits(s) |  Gets  | Reqs | Bytes |          |
===================================================================================================================================
|    1       | QC p004 p005 p006 p007 |     0.10 |    0.03 |     0.04 |        0.00 |     0.03 |      60 |      8 |    6MB |          |
|    2       | p004 p005 p006 p007    |     0.06 |    0.02 |     0.04 |         |        |      77 |      8 |    6MB |          |
===================================================================================================================================

SQL Plan Monitoring Details (Plan Hash Value=3705175653)
======================================================================================================================================================
| Id |          Operation     |     Name    |  Rows   | Cost |   Time    | Start  | Execs |   Rows     | Read | Read    | Activity | Activity Detail |
|    |                |        | (Estim) |     | Active(s) | Active |       | (Actual) | Reqs | Bytes |   (%)    |   (# samples)   |
======================================================================================================================================================
|  0 | SELECT STATEMENT     |        |      |     |       1 |       +0 |     1 |      499 |    |    |       |             |
|  1 |     COUNT STOPKEY        |        |      |     |       1 |       +0 |     1 |      499 |    |    |       |             |
|  2 |      PX COORDINATOR    |        |      |     |       1 |       +0 |     9 |      499 |    |    |       |             |
|  3 |       PX SEND QC (RANDOM)    | :TQ10000    |      4M |  964 |       2 |       +0 |     8 |     3992 |    |    |       |             |
|  4 |        COUNT STOPKEY    |        |      |     |       2 |       +0 |     8 |     3992 |    |    |       |             |
|  5 |         PX BLOCK ITERATOR    |        |      4M |  964 |       2 |       +0 |     8 |     3992 |    |    |       |             |
|  6 |          TABLE ACCESS FULL | EMPLOYEE_TEST |      4M |  964 |       2 |       +0 |     9 |     3992 |   16 |  12MB |       |             |
======================================================================================================================================================

SQL> SPOOL OFF
ACTIVE尊享版

SET LONG 1000000
SET LONGCHUNKSIZE 1000000
SET LINESIZE 1000
SET PAGESIZE 0
SET TRIM ON
SET TRIMSPOOL ON
SET ECHO OFF
SET FEEDBACK OFF

SQL> SPOOL report_sql_monitor.htm

SELECT dbms_sqltune.report_sql_monitor(sql_id => '2v0bzu74hyj30',report_level => 'ALL',type=>'ACTIVE') comm FROM dual;

SQL> SPOOL OFF

4,参考:

https://oracle-base.com/articles/11g/real-time-sql-monitoring-11gr1

http://www.oracle.com/technetwork/database/manageability/sqlmonitor-084401.html

http://blog.itpub.net/23718752/viewspace-1216422/

http://www.eygle.com/archives/2012/09/sqloracle_sql_monitor_report.html

Doc ID 1380492.1

11g SQL Monitor的更多相关文章

  1. sql monitor生成不了报告& FFS hint不生效两个问题思考

    事情的发生就是这么偶然,一步步的深入才能汲取到更深入的知识~~ -------------------START------------------------------------------- ...

  2. 【转载】sql monitor

    来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27067062/viewspace-2129635/ SQL Monitor Report 1. SQL Monit ...

  3. Oracle SQL调优系列之SQL Monitor Report

    @ 目录 1.SQL Monitor简介 2.捕捉sql的前提 3.SQL Monitor 参数设置 4.SQL Monitor Report 4.1.SQL_ID获取 4.2.Text文本格式 4. ...

  4. DB SQL Monitor 阻塞及等待事件监控工具

    SQL Monitor Designed By zhaoguan wang 说明------------------------------------------------------------ ...

  5. 利用 SQL Monitor 查看语句运行状态步骤

    利用 SQL Monitor 查看语句运行状态步骤 1.确定语句被 SQL Monitor 监控 SQL> SELECT * FROM GV$SQL_MONITOR WHERE sql_id=' ...

  6. [SQL]透過redgate SQL Monitor 來找出 ASYNC_NETWORK_IO 問題

    原文:[SQL]透過redgate SQL Monitor 來找出 ASYNC_NETWORK_IO 問題 最近因為在查一個SQL的效能問題,透過 sys.dm_os_wait_stats 來取得To ...

  7. 我的工具:Db SQL Monitor

    SQL Monitor 是一款界面简洁.绿色小巧的sql活动监视器,它能够帮助用户对 SQL Server 运行进程和Job进行实时监视,您可以查看当前执行的SQL/命令并终止. 工具下载地址:htt ...

  8. DB SQL Monitor 会话状态及等待事件监控工具

    DB SQL Monitor v1.7.6       Designed by Wang Zhaoguan   工具说明 --------------------------------------- ...

  9. Oracle Database 11g : SQL 基础

    简介 1:课程目标 2:课程 目标 3:Oracle Database 11g 以及相关产品概览 1:Oracle Database 11g :重点领域 2:Oracle Fusion Middlew ...

随机推荐

  1. Python super继承详解

    MRO(Method resolution order)是python用来解析方法调用顺序的,mro中记录了一个类的所有基类的类类型序列,super不是简单地调用基类的方法,而是按照MRO中的顺序来调 ...

  2. svn co 与ssl

    默认情况下, yum安装的svn用的是GnuTLS, 而不是ssl, 导致checkout https协议打包的svn repo的时候会报错. 解决方法是用openssl重新编译安装svn.注意ssl ...

  3. python编码问题(2)

    先上代码: # -*- coding: utf-8 -*- import sys import urllib2 import re import chardet import sys print sy ...

  4. openerp child_of操作符深度解析

    child_of  此操作符,从代码来看,等价于: [('x','child_of',id)] ==>  x.prarent_left >=id.parent_left && ...

  5. ndk学习6: 使用gdb调试ndk程序一

    生成debug版程序 方法一: 使用ndk-build编译时,加上如下参数NDK_DEBUG=1,之后生成so文件之外,还会生成gdbobserver,gdb.setup调式文件   方法二: 修改A ...

  6. Selenium webdriver 操作日历控件

    一般的日期控件都是input标签下弹出来的,如果使用webdriver 去设置日期, 1. 定位到该input 2. 使用sendKeys 方法 比如: 但是,有的日期控件是readonly的 比如1 ...

  7. ubuntu下安装mysql

    现在的软件越来越好安装,尤其是在ubuntu下安装软件,更是没有技巧,只需要在联网的情况下使用apt-get inatll 即可.在决定安装mysql之前,要先确定系统是否已经安装mysql.如下图: ...

  8. SQL Server遍历表的几种方法 转载

    SQL Server遍历表的几种方法 阅读目录 使用游标 使用表变量 使用临时表 在数据库开发过程中,我们经常会碰到要遍历数据表的情形,一提到遍历表,我们第一印象可能就想到使用游标,使用游标虽然直观易 ...

  9. 【编程题目】如何对n个数进行排序,要求时间复杂度O(n),空间复杂度O(1)

    转自:http://blog.csdn.net/vast_sea/article/details/8167968 看上去似乎任何已知的算法都无法做到,如果谁做到了,那么所有的排序方法:QuickSor ...

  10. 【编程题目】输入两个整数 n 和 m,从数列 1,2,3.......n 中 随意取几个数, 使其和等于 m ... ★

    第 21 题(数组)2010 年中兴面试题编程求解:输入两个整数 n 和 m,从数列 1,2,3.......n 中 随意取几个数,使其和等于 m ,要求将其中所有的可能组合列出来. 我的思路: 从小 ...