当前位置:  数据库>oracle

Oracle AWR报告生成与查看

    来源: 互联网  发布时间:2017-04-01

    本文导语: 可以通过dba_hist_wr_control查看当前的配置情况,当前awr为每1小时做一次数据快照,保留时间为7天。 SYS@PENG SQL> select * from dba_hist_wr_control;      DBID SNAP_INTERVAL               RETENTION                           ...

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

SYS@PENG SQL> select * from dba_hist_wr_control;
      DBID SNAP_INTERVAL               RETENTION                             TOPNSQL
---------- --------------------------- ------------------------------------ ----------
 620748923 +00000 01:00:00.0           +00007 00:00:00.0                     DEFAULT


Elapsed: 00:00:00.16
SYS@PENG SQL>

调整配置数据:

SYS@PENG SQL> execute dbms_workload_repository.modify_snapshot_settings(interval=>30,retention=>14000);

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.17
再查看修改后的效果:

SYS@PENG SQL> select * from dba_hist_wr_control;
      DBID SNAP_INTERVAL               RETENTION                             TOPNSQL
---------- --------------------------- ------------------------------------ ----------
 620748923 +00000 00:30:00.0           +00009 17:20:00.0                     DEFAULT


Elapsed: 00:00:00.02
SYS@PENG SQL>

除自动建立快照以外,还可以在需要的时候手工创建快照,数据和自动创建的一样使用。

SYS@PENG SQL> select dbms_workload_repository.create_snapshot() from dual;
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT()
------------------------------------------
                                        68


Elapsed: 00:00:01.00
SYS@PENG SQL> select dbms_workload_repository.create_snapshot() from dual;
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT()
------------------------------------------
                                        69



Elapsed: 00:00:00.60
SYS@PENG SQL>

[Oracle@localhost admin]$ pwd
/oracle/product/10g/rdbms/admin

这里存放了很多sql脚本,有时间可以打开阅读,对提高水平有作用。这里我们用到awrrpt.sql。

可以先打开看一下内容。

[oracle@localhost admin]$ cat awrrpt.sql

Rem $Header: awrrpt.sql 24-oct-2003.12:04:53 pbelknap Exp $
Rem
Rem awrrpt.sql
Rem
Rem Copyright (c) 1999, 2003, Oracle Corporation.  All rights reserved.
Rem
Rem    NAME
Rem      awrrpt.sql
Rem
Rem    DESCRIPTION
Rem      This script defaults the dbid and instance number to that of the
Rem      current instance connected-to, then calls awrrpti.sql to produce
Rem      the Workload Repository report.
Rem
Rem    NOTES
Rem      Run as select_catalog privileges.
Rem      This report is based on the Statspack report.
Rem
Rem      If you want to use this script in an non-interactive fashion,
Rem      see the 'customer-customizable report settings' section in
Rem      awrrpti.sql
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    pbelknap    10/24/03 - swrfrpt to awrrpt
Rem    pbelknap    10/14/03 - moving params to rpti
Rem    pbelknap    10/02/03 - adding non-interactive mode cmnts
Rem    mlfeng      09/10/03 - heading on
Rem    aime        04/25/03 - aime_going_to_main
Rem    mlfeng      01/27/03 - mlfeng_swrf_reporting
Rem    mlfeng      01/13/03 - Update comments
Rem    mlfeng      07/08/02 - swrf flushing
Rem    mlfeng      06/12/02 - Created
Rem































--
-- Get the current database/instance information - this will be used
-- later in the report along with bid, eid to lookup snapshots

set echo off heading on underline on;
column inst_num  heading "Inst Num"  new_value inst_num  format 99999;
column inst_name heading "Instance"  new_value inst_name format a12;
column db_name   heading "DB Name"   new_value db_name   format a12;
column dbid      heading "DB Id"     new_value dbid      format 9999999999 just c;



prompt
prompt Current Instance
prompt ~~~~~~~~~~~~~~~~

select d.dbid            dbid
     , d.name            db_name
     , i.instance_number inst_num
     , i.instance_name   inst_name
  from v$database d,
       v$instance i;




@@awrrpti

undefine num_days;
undefine report_type;
undefine report_name;
undefine begin_snap;
undefine end_snap;
--
-- End of file






其中一段的结果为
select d.dbid            dbid
     , d.name            db_name
     , i.instance_number inst_num
     , i.instance_name   inst_name
  from v$database d,
       v$instance i;




      DBID DB_NAME     INST_NUM INST_NAME
---------- --------- ---------- ----------------
 620748923 PENG               1 peng


然后调用了awrrpti.sql,其内容较多,以后找机会在专门分析。

这里我们直接执行awrrpt.sql。

SYS@PENG SQL> @/oracle/product/10g/rdbms/admin/awrrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
  620748923 PENG                1 peng


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'
Enter value for report_type: text





Type Specified:  text


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 620748923         1 PENG         peng         localhost

Using  620748923 for database Id
Using          1 for instance number


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.





Enter value for num_days: 2

Listing the last 2 days of Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
peng         PENG                58 12 Dec 2010 01:11      1
                                 59 12 Dec 2010 02:01      1
                                 60 12 Dec 2010 03:01      1
                                 61 12 Dec 2010 04:02      1
                                 62 12 Dec 2010 05:02      1






                                 63 13 Dec 2010 01:00      1

                                 64 13 Dec 2010 02:00      1
                                 65 13 Dec 2010 03:02      1
                                 66 13 Dec 2010 04:01      1
                                 67 13 Dec 2010 04:54      1
                                 68 13 Dec 2010 04:59      1
                                 69 13 Dec 2010 05:00      1
                                 70 13 Dec 2010 05:30      1





 

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 64
Begin Snapshot Id specified: 64


Enter value for end_snap: 70
End   Snapshot Id specified: 70

 

Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_64_70.txt.  To use this name,
press to continue, otherwise enter an alternative.


Enter value for report_name: /tmp/awrrpt_1_64_70.txt

生成文件存放在指定的/tmp下。

文件包含一下内容:

  • Report Summary
  • Wait Events Statistics
  • SQL Statistics
  • Instance Activity Statistics
  • IO Stats
  • Buffer Pool Statistics
  • Advisory Statistics
  • Wait Statistics
  • Undo Statistics
  • Latch Statistics
  • Segment Statistics
  • Dictionary Cache Statistics
  • Library Cache Statistics
  • Memory Statistics
  • Streams Statistics
  • Resource Limit Statistics
  • init.ora Parameters

    
 
 
 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • Linux系统查看Oracle服务是否启动
  • Oracle中查看当前用户的表
  • Linux系统下查看oracle SID的方法
  • linux下如何查看是什么用户安装的oracle
  • Oracle中查看某列数据类型
  • 查看Oracle的执行计划一句话命令
  • oracle查看会话锁定的所有对象代码分享
  • oracle数据库中查看系统存储过程的方法
  • solaris9下怎么查看oracle服务是否启动,以及怎么启动,在线等待。
  • 查看修改Oracle10G归档日志空间的限制
  • 查看及修改Oracle编码格式方法
  • c/c++开源软件 iis7站长之家
  • oracle删除主键查看主键约束及创建联合主键
  • oracle查看表空间已分配和未分配空间的语句分享
  • oracle查看被锁的表和被锁的进程以及杀掉这个进程
  • Oracle字符集修改查看方法
  • Oracle数据库里查看表空间使用状况
  • 在oracle 数据库中查看一个sql语句的执行时间和SP2-0027错误
  • Oracle查看和修改连接数(进程/会话/并发等等)
  • ORACLE查看并修改最大连接数的具体步骤
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • oracle 11g最新版官方下载地址
  • 请问su oracle 和su - oracle有什么不同?
  • Oracle 数据库(oracle Database)Select 多表关联查询方式
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3