• 概述
  • 示例
    • 以oracle用户登录到数据库主机执行脚本
    • 查看报告

概述

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 2018Copyright (c) 1982, 2013, Oracle.  All rights reserved.## 登录特定的用户,输入密码
SQL> connect cc@PR_CC
Enter password:
Connected.
## 执行awrddrpt脚本
SQL> @?/rdbms/admin/awrddrptCurrent Instance
~~~~~~~~~~~~~~~~DB Id       DB Id    DB Name      Inst Num Inst Num Instance
----------- ----------- ------------ -------- -------- ------------2143881171  2143881171 CC                  1        1 ccSpecify 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:  htmlInstances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 2143881171        1 CC           cc           ocsdb01Database 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 snapshotsSpecify 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: 2Listing the last 2 days of Completed SnapshotsSnap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
cc           CC               10080 30 Mar 2018 00:00      110081 30 Mar 2018 01:00      110082 30 Mar 2018 02:00      110083 30 Mar 2018 03:00      110084 30 Mar 2018 04:00      110085 30 Mar 2018 05:00      110086 30 Mar 2018 06:00      110087 30 Mar 2018 07:00      110088 30 Mar 2018 08:00      110089 30 Mar 2018 09:00      110090 30 Mar 2018 10:00      110091 30 Mar 2018 11:00      110092 30 Mar 2018 12:00      110093 30 Mar 2018 13:00      110094 30 Mar 2018 14:00      110095 30 Mar 2018 15:00      110096 30 Mar 2018 16:00      110097 30 Mar 2018 17:00      110098 30 Mar 2018 18:00      110099 30 Mar 2018 19:00      110100 30 Mar 2018 20:00      110101 30 Mar 2018 21:00      110102 30 Mar 2018 22:00      110103 30 Mar 2018 23:00      110104 31 Mar 2018 00:00      110105 31 Mar 2018 01:00      110106 31 Mar 2018 02:00      110107 31 Mar 2018 03:00      110108 31 Mar 2018 04:00      110109 31 Mar 2018 05:00      110110 31 Mar 2018 06:00      110111 31 Mar 2018 07:00      110112 31 Mar 2018 08:00      110113 31 Mar 2018 09:00      110114 31 Mar 2018 10:00      110115 31 Mar 2018 11:00      1Specify 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: 10081Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 2143881171        1 CC           cc           ocsdb01Database 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 snapshotsSpecify 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: 1Listing the last day's Completed SnapshotsSnap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
cc           CC               10104 31 Mar 2018 00:00      110105 31 Mar 2018 01:00      110106 31 Mar 2018 02:00      110107 31 Mar 2018 03:00      110108 31 Mar 2018 04:00      110109 31 Mar 2018 05:00      110110 31 Mar 2018 06:00      110111 31 Mar 2018 07:00      110112 31 Mar 2018 08:00      110113 31 Mar 2018 09:00      110114 31 Mar 2018 10:00      110115 31 Mar 2018 11:00      1Specify 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: 10105Specify 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_rptUsing 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$]

查看报告

Oracle-awrddrpt.sql比较两个AWR差异报告相关推荐

  1. oracle sql判断相等,Oracle PL/SQL判断两个字段相等或不等问题

    Oracle PL/SQL中判断两个两个字段相等或者不相等的时候,常常出现:字段值明明不相等(一个空,一个不空),但是判断不相等的时候就是得不到TRUE. 例如以下代码: ... a1  VARCHA ...

  2. oracle数据库 SQL 保留两位小数,四舍五入

    一.问题描述 数据库里的 float momey 类型,都会精确到多位小数.但有时候 我们不需要那么精确,例如,只精确到两位有效数字. 二.解决: 1. 使用 Round() 函数,如 Round(@ ...

  3. oracle中execute函数,Oracle 动态SQL execute immediate写法 zt

    Oracle 动态SQL有两种写法:用 DBMS_SQL 或 execute immediate,建议使用后者.试验步骤如下: 1. DDL 和 DML/*** DDL ***/ begin EXEC ...

  4. oracle结构体转为字符,CSS_细化解析:Oracle与SQL过程之间的转化,这两天写数据库升级脚本,发 - phpStudy...

    细化解析:Oracle与SQL过程之间的转化 这两天写数据库升级脚本,发现MSSQL和Oracle之间的转化还是比较容易的. 以下面两个过程为例.两者的功能相似. 1.MSSQL脚本 1 /** 更改 ...

  5. oracle横向合并两张表,SQL中将两个表合并成一个新表 SQL如何合并两个表并生成一个新表?...

    sql把两个表合并成一个新表的语句应该怎么写SQL SERVER: select * into 表3 from ( select 字段列表1 from 表1 union all select 字段列表 ...

  6. 深度对比Oracle与SQL Server

    本译文采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议发布,转载请保留此信息 译者:马齿苋 | 链接:http://www.dbabeta.com/2010/oracle ...

  7. Oracle查看SQL执行计划的方式

    Oracle查看SQL执行计划的方式 获取Oracle sql执行计划并查看执行计划,是掌握和判断数据库性能的基本技巧.下面案例介绍了多种查看sql执行计划的方式: 基本有以下几种方式: 1.通过sq ...

  8. oracle 判断如果有符合条件的记录则不插入_Oracle数据库AWR部分报告说明

    AWR全称AutomaticWorkload Repository,自动负载信息库,提供了一个时间段内整个系统的报表数据.通过AWR报告,可以分析指定的时间段内数据库系统的性能. 使用oracle自动 ...

  9. Oracle与SQL Server在企业应用中的比较(转)

    Oracle与SQL Server在企业应用中的比较(转)[@more@] 在我供职的公司不仅仅拥有Oracle数据库,同时还拥有SQL Server数据库,所以我经常遇见人们向我提两种问题. 第一种 ...

最新文章

  1. python merge很费内存吗,python如何使用merge实现堆
  2. Solr搜索的排序打分规则探讨
  3. 关联容器的插入操作简单举例
  4. kafka rabbitmq优劣对比_Kafka、RabbitMQ、RocketMQ等消息中间件的对比
  5. 首汽约车上线行程录音功能 产生司乘纠纷时可用于调查取证
  6. LintCode:尾部的零
  7. 「三分钟系列07」3分钟看懂哈夫曼树与哈夫曼编码
  8. 51CTO专访:谈谈SOC安全管理平台
  9. 音视频编解码技术(二):AAC 音频编码技术
  10. HTML5的骨架是什么,HTML5 骨架
  11. Centos 7分区合并
  12. 翻新iPad可以购买吗?有什么需要注意的地方
  13. 如何为您的PHP应用程序创建Slack接口
  14. Oracle数据库服务器端和客服端的安装
  15. TCAM与HASH表的差异
  16. java 进制转换工具_进制转换工具(JAVA)
  17. 优秀WinRT用户界面开发工具推荐
  18. ros学习笔记12——python实现发布和接收ros topic
  19. 登录提示:You are required to change your password immediately (password aged)
  20. 如何使用扫码实现收派件?

热门文章

  1. unity保存运行时的操作_Unity运行时保存prefab的方法一则
  2. tensorflow max_pooling
  3. keras 多个显卡
  4. threadlocal内存泄露_ThreadLocal 简介
  5. iphone屏蔽系统更新_未越狱屏蔽系统更新还是来了
  6. 131. Leetcode 191. 位1的个数 (位运算-汉明距离相关题目)
  7. 129. Leetcode 202. 快乐数 (哈希表)
  8. python~文件遍历命令:glob、os.walk
  9. 万物之始正则表达式全解析三部曲(中篇)-正则表达式运算符优先级及匹配规则
  10. Linux疑难杂症解决方案100篇(七)-SHELL编程变量与四则运算