Oracle-awrddrpt.sql比较两个AWR差异报告

简介: Oracle-awrddrpt.sql比较两个AWR差异报告

概述


awrddrpt.sql脚本位于$ORACLE_HOME/rdbms/admin目录中。


awrddrpt.sql脚本比较两个时间段的AWR报告。


这个脚本的交互部分最重要的就是需要输入要进行对比的两个awr报告的begin snap_id与end snap_id


一旦收集到四个快照号码,awrddrpt.sql脚本将创建两个AWR报告,然后比较这两个报告。awrddrpt.sql脚本对于比较两个经过时间段内的性能非常有用。


示例


我们打算比对3月30号00:00~01:00 和 3月31号00:00~01:00这两个时间段的AWR


oracle用户登录到数据库主机执行脚本

.....
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Sat Mar 31 09:48:24 2018 from 172.25.21.204
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
You have new mail.
##处于安全的考虑,以nolog的方式登录
ocsdb01:[/oracle$]sqlplus /nolog          
SQL*Plus: Release 11.2.0.4.0 Production on Sat Mar 31 11:23:08 2018
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
## 登录特定的用户,输入密码
SQL> connect cc@PR_CC
Enter password: 
Connected.
## 执行awrddrpt脚本
SQL> @?/rdbms/admin/awrddrpt
Current Instance
~~~~~~~~~~~~~~~~
   DB Id       DB Id    DB Name      Inst Num Inst Num Instance
----------- ----------- ------------ -------- -------- ------------
 2143881171  2143881171 CC                  1        1 cc
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
## 默认html
Enter value for report_type: 
Type Specified:  html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 2143881171        1 CC           cc           ocsdb01
Database Id and Instance Number for the First Pair of Snapshots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using 2143881171 for Database Id for the first pair of snapshots
Using          1 for Instance Number for the first pair of snapshots
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing <return> without
specifying a number lists all completed snapshots.
#因为今天是31号,我们只需要输入2天时间范围就可以获取到3月30号00:00~01:00的快照
Enter value for num_days: 2
Listing the last 2 days of Completed Snapshots
                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
cc           CC               10080 30 Mar 2018 00:00      1
                              10081 30 Mar 2018 01:00      1
                              10082 30 Mar 2018 02:00      1
                              10083 30 Mar 2018 03:00      1
                              10084 30 Mar 2018 04:00      1
                              10085 30 Mar 2018 05:00      1
                              10086 30 Mar 2018 06:00      1
                              10087 30 Mar 2018 07:00      1
                              10088 30 Mar 2018 08:00      1
                              10089 30 Mar 2018 09:00      1
                              10090 30 Mar 2018 10:00      1
                              10091 30 Mar 2018 11:00      1
                              10092 30 Mar 2018 12:00      1
                              10093 30 Mar 2018 13:00      1
                              10094 30 Mar 2018 14:00      1
                              10095 30 Mar 2018 15:00      1
                              10096 30 Mar 2018 16:00      1
                              10097 30 Mar 2018 17:00      1
                              10098 30 Mar 2018 18:00      1
                              10099 30 Mar 2018 19:00      1
                              10100 30 Mar 2018 20:00      1
                              10101 30 Mar 2018 21:00      1
                              10102 30 Mar 2018 22:00      1
                              10103 30 Mar 2018 23:00      1
                              10104 31 Mar 2018 00:00      1
                              10105 31 Mar 2018 01:00      1
                              10106 31 Mar 2018 02:00      1
                              10107 31 Mar 2018 03:00      1
                              10108 31 Mar 2018 04:00      1
                              10109 31 Mar 2018 05:00      1
                              10110 31 Mar 2018 06:00      1
                              10111 31 Mar 2018 07:00      1
                              10112 31 Mar 2018 08:00      1
                              10113 31 Mar 2018 09:00      1
                              10114 31 Mar 2018 10:00      1
                              10115 31 Mar 2018 11:00      1
Specify the First Pair of Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## 选择开始的快照
Enter value for begin_snap: 10080
First Begin Snapshot Id specified: 10080
## 选择结束的快照
Enter value for end_snap: 10081
First End   Snapshot Id specified: 10081
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 2143881171        1 CC           cc           ocsdb01
Database Id and Instance Number for the Second Pair of Snapshots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using 2143881171 for Database Id for the second pair of snapshots
Using          1 for Instance Number for the second pair of snapshots
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing <return> without
specifying a number lists all completed snapshots.
#因为今天是31号,我们只需要输入1天时间范围就可以获取到3月31号00:00~01:00
Enter value for num_days2: 1
Listing the last day's Completed Snapshots
                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
cc           CC               10104 31 Mar 2018 00:00      1
                              10105 31 Mar 2018 01:00      1
                              10106 31 Mar 2018 02:00      1
                              10107 31 Mar 2018 03:00      1
                              10108 31 Mar 2018 04:00      1
                              10109 31 Mar 2018 05:00      1
                              10110 31 Mar 2018 06:00      1
                              10111 31 Mar 2018 07:00      1
                              10112 31 Mar 2018 08:00      1
                              10113 31 Mar 2018 09:00      1
                              10114 31 Mar 2018 10:00      1
                              10115 31 Mar 2018 11:00      1
Specify the Second Pair of Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## 选择开始的快照
Enter value for begin_snap2: 10104
Second Begin Snapshot Id specified: 10104
## 选择结束的快照
Enter value for end_snap2: 10105
Second End   Snapshot Id specified: 10105
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrdiff_1_10080_1_10104.html  To use this name,
press <return> to continue, otherwise enter an alternative.
## 输入awr报告名称
Enter value for report_name: artisan_awr_diff_rpt
Using the report name artisan_awr_diff_rpt
......省略输出过程
......
......
</body></html>
Report written to artisan_awr_diff_rpt
## 退出
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ocsdb01:[/oracle$]
## 当前目录下查找输出的报告
ocsdb01:[/oracle$]ls artisan_awr_diff_rpt*
artisan_awr_diff_rpt.lst
ocsdb01:[/oracle$]


查看报告


20180331234608920.png


相关文章
|
9月前
|
Oracle 关系型数据库 数据库
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
163 0
|
2月前
|
SQL 监控 Oracle
Oracle 性能优化之AWR、ASH和ADDM(含报告生成和参数解读)
Oracle 性能优化之AWR、ASH和ADDM(含报告生成和参数解读)
|
2月前
修改oracle11g的awr快照参数
修改oracle11g的awr快照参数
16 0
|
10月前
|
SQL 数据库
使用事务码 SAT 比较传统的 SELECT SQL 语句和 OPEN / FETCH CURSOR 分块读取 ABAP 数据库表两种方式的性能差异试读版
使用事务码 SAT 比较传统的 SELECT SQL 语句和 OPEN / FETCH CURSOR 分块读取 ABAP 数据库表两种方式的性能差异试读版
|
SQL Oracle 关系型数据库
Oracle-使用awrrpt.sql生成AWR报告
Oracle-使用awrrpt.sql生成AWR报告
214 0
【SQL开发实战技巧】系列(二十五):数仓报表场景☞结果集中的重复数据只显示一次以及计算部门薪资差异高效的写法以及如何对数据进行快速分组
本篇文章讲解的主要内容是:***如何使用lag函数让结果集重复数据只显示一次、用行转列pivot写法优化部门之间计算工资差异类似需求、如何通过ceil函数对已有数据进行分组打印、放假安排团队分组值班,如何通过ntile()over(order by )快速进行人员分组***
【SQL开发实战技巧】系列(二十五):数仓报表场景☞结果集中的重复数据只显示一次以及计算部门薪资差异高效的写法以及如何对数据进行快速分组
【SQL开发实战技巧】系列(七):从有重复数据前提下如何比较出两个表中的差异数据及对应条数聊起
本篇文章讲解的主要内容是:***如果有重复数据如何检查出两个表中的差异数据及对应条数、表连接做聚合容易出现重复计算的错误、多表查询空值处理问题、NOT IN的子查询范围不能是空值,否则查询结果为空。***
【SQL开发实战技巧】系列(七):从有重复数据前提下如何比较出两个表中的差异数据及对应条数聊起
|
SQL 数据库
使用事务码 SAT 比较传统的 SELECT SQL 语句和 OPEN / FETCH CURSOR 分块读取 ABAP 数据库表两种方式的性能差异试读版
使用事务码 SAT 比较传统的 SELECT SQL 语句和 OPEN / FETCH CURSOR 分块读取 ABAP 数据库表两种方式的性能差异试读版
|
SQL Oracle 关系型数据库
Oracle 使用 PL/SQL Developer 生成 AWR 报告
Oracle AWR报告是用来分析数据库故障和性能的重要指标报告!
Oracle 使用 PL/SQL Developer 生成 AWR 报告
|
Oracle 关系型数据库 数据库
Oracle中的差异增量备份和累积增量备份的区别、rman全备+增量备份常用脚本
Oracle中的差异增量备份和累积增量备份的区别、rman全备+增量备份常用脚本
1252 0

推荐镜像

更多