oracle awrdiff,手工生成AWR运行期对比报告记录

AWR(Automatic Workload Repository)报告是Oracle 10g之后推出的重要性能诊断工具。AWR是作为Statspack报告的一种有力延伸。借助AWR,我们可以方便的对Oracle数据库的特定工作时间段进行性能分析评价,最终达到发现瓶颈调优的目标。

作为DBA,手工生成AWR报告是工作基本功之一。笔者在之前的《手工生成AWR报告记录》(http://space.itpub.net/17203031/viewspace-700471)中,就已经详细介绍过如何在sqlplus工具下生成AWR报告。

1、从AWR到AWR Compare Period Report

AWR是一个产品体系,根据定时收集的系统运行数据,我们其实可以做的更多。在现在主流的运维管理和调优过程中,基线baseline的概念是一直贯穿始终。系统运行负载Baseline、关键SQL执行计划Baseline等等,反复出现。总之,所谓的Baseline,简单的说就是一套运行负载指标或者执行计划指标。当你认为系统出现问题的时候,可以将Baseline作为标准进行对比,发现问题所在。进一步的,可以将Baseline作为应急手段,强制使用应对生产(SQL Profile、SPM)。

我们一般的调优过程中,也的确需要这样的小工具。比如:业务高峰期和低谷期,数据库各方面指标有什么样显著的差异?进行调优之后,系统性能指标有何种方式变化?这种时候,生成两份AWR,看着对比的确是一种方法。但是,Oracle已经为我们提供出AWR Compare Period Report来方便实现这样的功能。

从原理上,AWR Compare Period Report不难理解。Oracle将各个时间snap的性能数据保存在SYSAUX表空间的一系列数据字典表中,只要经过合理的组织,compare report不是一件困难的事情。

2、手工生成报告

本文是一篇记录文章,依然采用手工sqlplus的方法生成报告。

ü登录sqlplus,运行脚本

使用sqlplus,登录入指定系统。

D:\>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on 星期一 3月 5 09:02:42 2012

Copyright (c) 1982, 2010, Oracle.All rights reserved.

SQL>(登录过程略……)

--调用脚本

SQL> @?/rdbms/admin/awrddrpt.sql

注意:在sqlplus中,?表示$ORACLE_HOME路径。指定的awrddrpt.sql脚本,也是确实在客户端本地的SQL执行脚本。如果使用如PL/SQL Developer等开发工具,请指定直接路径。

ü输入基本报告类型

首先同AWR报告一样, Compare Period Report也存在TEXT和HTML两种格式支持。在创建过程中,我们需要进行选定。

Current Instance

~~~~~~~~~~~~~~~~

DB IdDB IdDB NameInst Num Inst Num Instance

----------- ----------- ------------ -------- -------- ------------

23511424672351142467 NBSTEST11 NBSTEST

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'

输入report_type 的值:

Type Specified:html

ü输入第一对比时间段项目

既然要做到对比,首先需要指定一个对比时间范围。这个过程同一般AWR报告相同,过程不予累述。

Instances in this Workload Repository schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DB IdInst Num DB NameInstanceHost

------------ -------- ------------ ------------ ------------

* 23511424671 NBSTESTNBSTESTP550_05_LC

Database Id and Instance Number for the First Pair of Snapshots

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using 2351142467 for Database Id for the first pair of snapshots

Using1 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 without

specifying a number lists all completed snapshots.

--输入对比时间范围

输入num_days 的值:3

之后,Oracle会列出三天范围的snap信息。

Listing the last 3 days of Completed Snapshots

Snap

InstanceDB NameSnap IdSnap StartedLevel

------------ ------------ --------- ------------------ -----

NBSTESTNBSTEST10251 03 3月2012 00:001

10252 03 3月2012 01:001

(篇幅原因,省略部分……)

10305 05 3月2012 06:001

Snap

InstanceDB NameSnap IdSnap StartedLevel

------------ ------------ --------- ------------------ -----

NBSTESTNBSTEST10306 05 3月2012 07:001

10307 05 3月2012 08:001

10308 05 3月2012 09:001

Specify the First Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

输入begin_snap 的值:

--指定时间片

Specify the First Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

输入begin_snap 的值:10296

First Begin Snapshot Id specified: 10296

输入end_snap 的值:10298

设定了开始和结束时间snap,作为第一个时间。

ü输入第二对比时间段项目

第二报告时间snap信息基本相同,不予累述。

Instances in this Workload Repository schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DB IdInst Num DB NameInstanceHost

------------ -------- ------------ ------------ ------------

* 23511424671 NBSTESTNBSTESTP550_05_LC

Database Id and Instance Number for the Second Pair of Snapshots

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using 2351142467 for Database Id for the second pair of snapshots

Using1 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 without

specifying a number lists all completed snapshots.

输入num_days2 的值:

输入num_days2 的值:1

Listing the last day's Completed Snapshots

Snap

InstanceDB NameSnap IdSnap StartedLevel

------------ ------------ --------- ------------------ -----

NBSTESTNBSTEST10299 05 3月2012 00:001

(篇幅原因,省略……)

10306 05 3月2012 07:001

10307 05 3月2012 08:001

10308 05 3月2012 09:001

Specify the Second Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

输入begin_snap2 的值:

--输入时间片

Specify the Second Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

输入begin_snap2 的值:10306

Second Begin Snapshot Id specified: 10306

输入end_snap2 的值:10308

ü指定生成报告名称,生成报告

Specify the Report Name

~~~~~~~~~~~~~~~~~~~~~~~

The default report file name is awrdiff_1_10296_1_10306.htmlTo use this name,

press to continue, otherwise enter an alternative.

输入report_name 的值:--使用默认名称,保持为空

Using the report name awrdiff_1_10296_1_10306.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值