AWR报告生成

一.生成AWR报告

[ractest @sun880 - 1   / u01 / app / oracle / orahome / rdbms / admin]$ cd  $ORACLE_HOME / rdbms / admin
[ractest
@sun880 - 1   / u01 / app / oracle / orahome / rdbms / admin]$ sqlplus  /  as sysdba
SQL
* Plus :  Release  10.2 . 0.4 . 0   -  Production on Sun Jan  27   20 : 47 : 38   2008
Copyright (c) 
1982 ,   2007 ,  Oracle .  All Rights Reserved .
Connected to
:
Oracle Database 10g Enterprise Edition Release 
10.2 . 0.4 . 0   -  64bit Production
With the Partitioning
,  Real Application Clusters ,  OLAP ,  Data Mining
and Real Application Testing options
SQL
>   @awrrpt
......
// 根据Oracle提示生成报告 ......

 注:报告生成在$ORACLE_HOME/rdbms/admin/目录下。

 

二.修改awr的默认设置

// 半小时采集一次,采集信息保存3天。
SQL > exec  dbms_workload_repository . modify_snapshot_settings (interval => 30 , retention  => 3 * 24 * 60 );

 

SQL> select * from dba_hist_wr_control;

      DBID SNAP_INTERVAL                RETENTION           TOPNSQL
---------- ---------------------------- ------------------- ----------
2420544136 +00000 02:00:00.0            +00005 00:00:00.0   DEFAULT

 

三.关闭AWR自动收集

SQL > exec  dbms_workload_repository . modify_snapshot_settings (interval => 0 , retention  => 24 * 60 );

:10g默认是自动开启awr信息收集的,会对系统有一定的影响(很小);如果要关闭awr信息收集,只需设置interval参数为0即可。但interval设0后,AWR报告无法生成。

 

 

 

如下是:

生成AWR报告的完整过程

Oracle 9i下,使用statspack生成性能报告。
Oracle 10g下,使用AWR生成性能报告,AWR报告需通过sys账户来生成。一个示例如下:

[oracle@testserver admin]$ pwd
/oracle/product/10g/rdbms/admin
[oracle@testserver admin]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 3月 18 09:33:44 2010

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

SQL> connect /as sysdba
已连接。
SQL> @awrrpt

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

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
1986166942 KMS                 1 kms


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 的值: text

Type Specified:  text


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

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 1986166942        1 KMS          kms          testserver

Using 1986166942 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 <return> without
specifying a number lists all completed snapshots.


输入 num_days 的值:  5

Listing the last 5 days of Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
kms          KMS               6634 14 3月  2010 00:00     1
                               6635 14 3月  2010 01:00     1
                               6636 14 3月  2010 02:00     1
                               6637 14 3月  2010 03:00     1
                               6638 14 3月  2010 04:00     1
                               6639 14 3月  2010 05:00     1
                               6640 14 3月  2010 06:00     1
                               6641 14 3月  2010 07:00     1
                               6642 14 3月  2010 08:00     1
                               6643 14 3月  2010 09:00     1
                               6644 14 3月  2010 10:00     1
                               6645 14 3月  2010 11:01     1
                               6646 14 3月  2010 12:01     1
                               6647 14 3月  2010 13:00     1
                               6648 14 3月  2010 14:00     1
                               6649 14 3月  2010 15:00     1
                               6650 14 3月  2010 16:00     1
                               6651 14 3月  2010 17:00     1
                               6652 14 3月  2010 18:00     1
                               6653 14 3月  2010 19:00     1
                               6654 14 3月  2010 20:00     1
                               6655 14 3月  2010 21:00     1
                               6656 14 3月  2010 22:00     1
                               6657 14 3月  2010 23:00     1
                               6658 15 3月  2010 00:00     1
                               6659 15 3月  2010 01:00     1
                               6660 15 3月  2010 02:00     1
                               6661 15 3月  2010 03:00     1
                               6662 15 3月  2010 04:00     1
                               6663 15 3月  2010 05:00     1
                               6664 15 3月  2010 06:00     1
                               6665 15 3月  2010 07:00     1
                               6666 15 3月  2010 08:00     1
                               6667 15 3月  2010 09:00     1
                               6668 15 3月  2010 10:00     1
                               6669 15 3月  2010 11:00     1
                               6670 15 3月  2010 12:00     1
                               6671 15 3月  2010 13:00     1
                               6672 15 3月  2010 14:00     1
                               6673 15 3月  2010 15:00     1
                               6674 15 3月  2010 16:00     1
                               6675 15 3月  2010 17:00     1
                               6676 15 3月  2010 18:00     1
                               6677 15 3月  2010 19:00     1
                               6678 15 3月  2010 20:01     1
                               6679 15 3月  2010 21:01     1
                               6680 15 3月  2010 22:01     1
                               6681 15 3月  2010 23:00     1
                               6682 16 3月  2010 00:00     1
                               6683 16 3月  2010 01:00     1
                               6684 16 3月  2010 02:00     1
                               6685 16 3月  2010 03:00     1
                               6686 16 3月  2010 04:00     1
                               6687 16 3月  2010 05:00     1
                               6688 16 3月  2010 06:00     1

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
输入 begin_snap 的值:  
6634
Begin Snapshot Id specified: 6634

输入 end_snap 的值:  6681
End   Snapshot Id specified: 6681



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

输入 report_name 的值:  

<此部分内容为生成的awrrpt报告的内容>

End of Report
Report written to awrrpt_1_6682_6739.txt

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值