我写的SQL调优专栏:https://blog.csdn.net/u014427391/article/category/8679315

对于局部的,比如某个页面列表sql,我们可以使用Oracle的执行计划进行sql调优,但是对于整个系统来说,你可以知道哪些sql比较耗时?当然可以通过查Oracle的共享池得到,不过Oracle系统本身就提供了几种性能分析报告,比如AWR、ASH、ADDM、AWRDD等等报告,本博客介绍一下AWRDD性能分析报告

AWRDD报告是Oracle针对不同时段的性能的一个比对报告

一、ADDM报告生成

继之前AWR、ASH方面的博客之后,https://smilenicky.blog.csdn.net/article/details/89414432,https://smilenicky.blog.csdn.net/article/details/89419185,我再写一篇ADDM方面的博客:

1.1 工具选择

对于Oracle数据库可以使用sqlplus或者plsql developer客户端软件

sqlplus 使用

可以使用sqlplus工具登录

进入数据库

  1. sqlplus / as sysdba

查看用户

  1. show parameter db_name

用登录之后才可以使用

plsql developer使用

plsql developer也可以使用,登录之后,选择文件(File)->新建(New)->命令窗口(Command Window)

1.2 自动创建快照

开始压测后执行

  1. exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();

可以通过dba_hist_wr_control查看当前的配置情况,当前awr为每1小时做一次数据快照,保留时间为8天。

  1. select * from dba_hist_wr_control;



修改配置,每隔30分钟收集一次,保存1天

  1. execute dbms_workload_repository.modify_snapshot_settings(interval=>30,retention=>14000);

关闭自动收集

  1. SQL>exec dbms_workload_repository.modify_snapshot_settings (interval=>0,retention=>24*60);

1.3 手工创建快照

除了自动创建快照,也可以手工创建快照

  1. select dbms_workload_repository.create_snapshot() from dual;

1.4 AWRDD报告生成

对于sqlplus客户端的可以使用

  1. @?/rdbms/admin/awrddrpt.sql

对于plsql客户端,我用绝对路径去执行,@?的命令找不到文件

这个要根据自己的Oracle安装路径去修改,例如:

  1. @D:/oracle/product/11.1.0/db_1/RDBMS/ADMIN/awrddrpt.sql

(1)快照报告格式

Enter value for report_type:html

有两种格式html和txt,这里选择html

(2)快照搜集天数

Enter value for num_days:1

快速搜集的天数,这里可以填个数字

(3)快照开始id1

Enter value for begin_snap:449

要根据日志打印的快照id范围来填,所以我可以填写:449

(4)快照结束id1

Enter value for end_snap:451

要根据日志打印的快照id范围来填,所以我可以填写:451

(5)快照收集天数2

Enter value for num_days2:1

快照收集天数,这里也可以填个数字,主要是来对比

(6)快速开始id2

Enter value for begin_snap2:450

也要在日志打印的范围内取:这里取450

(7)快照结束id2

Enter value for end_snap2:452

也要在日志打印的范围内取:这里取452

(8)AWRDD报告名称

Enter value for report_name

填写ADDM报告的名称,我可以填写awrdd_20190421.html,然后在打印的日志里有文件保存的路径:,比如:D:\oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN\awrddm.html

  1. SQL> @D:/oracle/product/11.2.0/dbhome_1/RDBMS/ADMIN/awrddrpt.sql
  2. Current Instance
  3. ~~~~~~~~~~~~~~~~
  4. DBID DBID2 DB_NAME INST_ INST_ INST_NAME
  5. ---------- ---------- ------------ ----- ----- ------------
  6. 1525762377 1525762377 ORCL 1 1 orcl
  7. rpt_options
  8. ---------
  9. 0
  10. Specify the Report Type
  11. ~~~~~~~~~~~~~~~~~~~~~~~
  12. Would you like an HTML report, or a plain text report?
  13. Enter 'html' for an HTML report, or 'text' for plain text
  14. Defaults to 'html'
  15. Type Specified: html
  16. Cannot SET TRIMSPOOL
  17. Cannot SET UNDERLINE
  18. Instances in this Workload Repository schema
  19. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. DBBID INSTT DBB_NAME INSTT_NAME HOST
  21. ------------ ----- ------------ ------------ ------------
  22. * 1525762377 1 ORCL orcl PC-201508171
  23. 906
  24. Database Id and Instance Number for the First Pair of Snapshots
  25. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  26. Using 1525762377 for Database Id for the first pair of snapshots
  27. Using 1 for Instance Number for the first pair of snapshots
  28. dbid
  29. ---------
  30. 1525762377
  31. inst_num
  32. ---------
  33. 1
  34. inst_num
  35. ---------
  36. 1
  37. dbid
  38. ---------
  39. 1525762377
  40. max_snap_time
  41. ---------
  42. 21/04/2019
  43. Specify the number of days of snapshots to choose from
  44. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. Entering the number of days (n) will result in the most recent
  46. (n) days of snapshots being listed. Pressing <return> without
  47. specifying a number lists all completed snapshots.
  48. Listing the last day's Completed Snapshots
  49. INST_NAME DB_NAME SNAP_ID SNAPDAT LV
  50. ------------ ------------ -------- ------------------ --
  51. orcl ORCL 448 21 Apr 2019 10:38 1
  52. orcl ORCL 449 21 Apr 2019 12:00 1
  53. orcl ORCL 450 21 Apr 2019 13:00 1
  54. orcl ORCL 451 21 Apr 2019 14:00 1
  55. orcl ORCL 452 21 Apr 2019 15:00 1
  56. dbid
  57. ---------
  58. 1525762377
  59. inst_num
  60. ---------
  61. 1
  62. dbid
  63. ---------
  64. 1525762377
  65. bid
  66. ---------
  67. 449
  68. eid
  69. ---------
  70. 451
  71. Specify the number of days of snapshots to choose from
  72. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73. Entering the number of days (n) will result in the most recent
  74. (n) days of snapshots being listed. Pressing <return> without
  75. specifying a number lists all completed snapshots.
  76. Listing the last day's Completed Snapshots
  77. INST_NAME DB_NAME SNAP_ID SNAPDAT LV
  78. ------------ ------------ -------- ------------------ --
  79. orcl ORCL 448 21 Apr 2019 10:38 1
  80. orcl ORCL 449 21 Apr 2019 12:00 1
  81. orcl ORCL 450 21 Apr 2019 13:00 1
  82. orcl ORCL 451 21 Apr 2019 14:00 1
  83. orcl ORCL 452 21 Apr 2019 15:00 1
  84. dbid2
  85. ---------
  86. 1525762377
  87. inst_num2
  88. ---------
  89. 1
  90. max_snap_time
  91. ---------
  92. 21/04/2019
  93. inst_num2
  94. ---------
  95. 1
  96. dbid2
  97. ---------
  98. 1525762377
  99. max_snap_time
  100. ---------
  101. 21/04/2019
  102. Specify the Second Pair of Begin and End Snapshot Ids
  103. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. Second Begin Snapshot Id specified: 450
  105. Second End Snapshot Id specified: 452
  106. bid2
  107. ---------
  108. 450
  109. eid2
  110. ---------
  111. 452
  112. inst_num2
  113. ---------
  114. 1
  115. dbid2
  116. ---------
  117. 1525762377
  118. bid2
  119. ---------
  120. 450
  121. eid2
  122. ---------
  123. 452
  124. Specify the Report Name
  125. ~~~~~~~~~~~~~~~~~~~~~~~
  126. The default report file name is awrdiff_1_449_1_450.html To use this name,
  127. press <return> to continue, otherwise enter an alternative.
  128. Using the report name awrdd.html
  129. Started spooling to D:\oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN\awrdd.html

二、AWRDD报告性能分析

AWRDD的报告分析和AWR有些是类似的,不过都是不同时期的

(1) AWRDD之不同时期的load profile

(2) AWRDD之不同时期的等待事件



(3) AWRDD不同时期的TOP SQL对比

Oracle AWRDD报告生成和性能分析的更多相关文章

  1. Oracle ADDM报告生成和性能分析

    我写的SQL调优专栏:https://blog.csdn.net/u014427391/article/category/8679315 对于局部的,比如某个页面列表sql,我们可以使用Oracle的 ...

  2. Oracle AWRSQRPT报告生成和性能分析

    我写的SQL调优专栏:https://blog.csdn.net/u014427391/article/category/8679315 对于局部的,比如某个页面列表sql,我们可以使用Oracle的 ...

  3. Oracle ASH报告生成和性能分析

    我写的SQL调优专栏:https://blog.csdn.net/u014427391/article/category/8679315 对于局部的,比如某个页面列表sql,我们可以使用Oracle的 ...

  4. Oracle AWR报告生成和性能分析

    目录 一.AWE报告生成步骤 1.1 工具选择 1.2 自动创建快照 1.3 手工创建快照 1.4 生成AWR报告 二.AWR报告分析 2.1 AWR之DB Time 2.2 AWR之load_pro ...

  5. ORACLE AWR报告生成步骤

    ORACLE AWR报告生成步骤 (以PL/SQL中命令窗口为例) 1.sqlplus或plsql的commod窗口(命令窗口)运行命令 @D:\oracle\product\10.2.0\db_1\ ...

  6. Oracle Update 语句语法与性能分析 - 多表关联

    Oracle Update 语句语法与性能分析 - 多表关联   为了方便起见,建立了以下简单模型,和构造了部分测试数据: 在某个业务受理子系统BSS中, SQL 代码 --客户资料表 create ...

  7. [转]oracle awr报告生成和分析

    转自:http://blog.csdn.net/cuker919/article/details/8767328 最近由于数据库cpu占用非常高,导致VCS常常自动切换,引起很多问题. 最近学习一下数 ...

  8. oracle sql语句跟踪及性能分析工具实现

    在网上找了一大圈,没找着合适的工具来跟踪oracle一段时间的sql. 我们的场景是打算自动化跑遍所有场景(rft)+fiddler跟踪请求+后端跟踪sql,根据结果去分析慢的请求和sql,本来awr ...

  9. Oracle awr报告生成操作步骤

    1.登录主机切换到oracle用户 ssh root@192.168.220.128 su - oracle 2.以sysdba身份登录数据库 sqlplus / as sysdba 3.执行@?/r ...

随机推荐

  1. 纯CSS打造进度条

    进度条效果如下: CSS部分 body { background-color: white; } .progress-bar { display: flex; flex-direction: row; ...

  2. dirlock.go

    // +build !windows package dirlock import (     "fmt"     "os"     "syscall ...

  3. Apache SkyWalking 为.NET Core带来开箱即用的分布式追踪和应用性能监控

    在大型网站系统设计中,随着分布式架构,特别是微服务架构的流行,我们将系统解耦成更小的单元,通过不断的添加新的.小的模块或者重用已经有的模块来构建复杂的系统.随着模块的不断增多,一次请求可能会涉及到十几 ...

  4. ssh框架整合笔记

    1.建立普通的Javaweb项目,导入项目所必须的jar包. 2.配置web.xml文件. web.xml  3.在src下建立struts.xml. struts.xm 4.在实体包下配置  实体名 ...

  5. PoiDemo【Android将表单数据生成Word文档的方案之二(基于Poi4.0.0)】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 使用Poi实现android中根据模板文件生成Word文档的功能.这里的模板文件是doc文件.如果模板文件是docx文件的话,请阅读 ...

  6. PPT分享第01季-226套多种风格模板

    包含商务欧美扁平风.唯美文艺IOS风.互联网计划书风.扁平风手绘风卡通风 .中国风等多种风格 下面是部分模板截图: 下面是下载地址

  7. 无敌简单快速的文件服务器sgfs

    前言 想要构建一个Linux文件服务器?看看下面几个要求是不是你想要的? 1.只需要单节点部署就够了 2.部署启动简单,下载之后,一键启动,一键关闭 3.不需要任何其他的依赖安装,而且运行时占用内存资 ...

  8. Netty源码—二、server启动(2)

    我们在使用Netty的时候的初始化代码一般如下 EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGro ...

  9. C# 操作Word页眉页脚——奇偶页/首页不同、不连续设置页码、复制页眉页脚、锁定页眉页脚、删除页眉页脚

    前言 本文是对Word页眉页脚的操作方法的进一步的阐述.在“C# 添加Word页眉页脚.页码”一文中,介绍了添加简单页眉页脚的方法,该文中的方法可满足于大多数的页眉页脚添加要求,但是对于比较复杂一点的 ...

  10. Morris遍历-如何用空间复杂度O(1)来遍历二叉树

    参照和学习: https://www.cnblogs.com/AnnieKim/archive/2013/06/15/morristraversal.html 解决的问题:如何使用空间复杂度O(1), ...