热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

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

  • 概述
  • 示例
    • 以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 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

......省略输出过程
......
......

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数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • 本文讨论了在数据库打开和关闭状态下,重新命名或移动数据文件和日志文件的情况。针对性能和维护原因,需要将数据库文件移动到不同的磁盘上或重新分配到新的磁盘上的情况,以及在操作系统级别移动或重命名数据文件但未在数据库层进行重命名导致报错的情况。通过三个方面进行讨论。 ... [详细]
  • WhenIusepythontoapplythepymysqlmoduletoaddafieldtoatableinthemysqldatabase,itdo ... [详细]
  • PDO MySQL
    PDOMySQL如果文章有成千上万篇,该怎样保存?数据保存有多种方式,比如单机文件、单机数据库(SQLite)、网络数据库(MySQL、MariaDB)等等。根据项目来选择,做We ... [详细]
  • 在Oracle11g以前版本中的的DataGuard物理备用数据库,可以以只读的方式打开数据库,但此时MediaRecovery利用日志进行数据同步的过 ... [详细]
  • 本文介绍了如何使用php限制数据库插入的条数并显示每次插入数据库之间的数据数目,以及避免重复提交的方法。同时还介绍了如何限制某一个数据库用户的并发连接数,以及设置数据库的连接数和连接超时时间的方法。最后提供了一些关于浏览器在线用户数和数据库连接数量比例的参考值。 ... [详细]
  • Oracle Database 10g许可授予信息及高级功能详解
    本文介绍了Oracle Database 10g许可授予信息及其中的高级功能,包括数据库优化数据包、SQL访问指导、SQL优化指导、SQL优化集和重组对象。同时提供了详细说明,指导用户在Oracle Database 10g中如何使用这些功能。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • Oracle10g备份导入的方法及注意事项
    本文介绍了使用Oracle10g进行备份导入的方法及相关注意事项,同时还介绍了2019年独角兽企业重金招聘Python工程师的标准。内容包括导出exp命令、删用户、创建数据库、授权等操作,以及导入imp命令的使用。详细介绍了导入时的参数设置,如full、ignore、buffer、commit、feedback等。转载来源于https://my.oschina.net/u/1767754/blog/377593。 ... [详细]
  • 本文介绍了iOS数据库Sqlite的SQL语句分类和常见约束关键字。SQL语句分为DDL、DML和DQL三种类型,其中DDL语句用于定义、删除和修改数据表,关键字包括create、drop和alter。常见约束关键字包括if not exists、if exists、primary key、autoincrement、not null和default。此外,还介绍了常见的数据库数据类型,包括integer、text和real。 ... [详细]
  • Oracle seg,V$TEMPSEG_USAGE与Oracle排序的关系及使用方法
    本文介绍了Oracle seg,V$TEMPSEG_USAGE与Oracle排序之间的关系,V$TEMPSEG_USAGE是V_$SORT_USAGE的同义词,通过查询dba_objects和dba_synonyms视图可以了解到它们的详细信息。同时,还探讨了V$TEMPSEG_USAGE的使用方法。 ... [详细]
  • 本文详细介绍了如何使用MySQL来显示SQL语句的执行时间,并通过MySQL Query Profiler获取CPU和内存使用量以及系统锁和表锁的时间。同时介绍了效能分析的三种方法:瓶颈分析、工作负载分析和基于比率的分析。 ... [详细]
  • Windows7 64位系统安装PLSQL Developer的步骤和注意事项
    本文介绍了在Windows7 64位系统上安装PLSQL Developer的步骤和注意事项。首先下载并安装PLSQL Developer,注意不要安装在默认目录下。然后下载Windows 32位的oracle instant client,并解压到指定路径。最后,按照自己的喜好对解压后的文件进行命名和压缩。 ... [详细]
  • 本文介绍了一个误删Oracle数据文件导致数据库无法打开的问题,并提供了解决方式。解决方式包括切换到mount状态、离线删除报错的数据文件等。 ... [详细]
  • 本文介绍了Oracle存储过程的基本语法和写法示例,同时还介绍了已命名的系统异常的产生原因。 ... [详细]
author-avatar
手机用户2602922857
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有