【oracle】生成AWR报告

【第一步】找到awrrpt.sql文件

[ora11g@vm-kvm11820-app ~]$ locate awrrpt.sql
/DATA/opt/app/ora11g/product/11.2.0/rdbms/admin/awrrpt.sql

 

【第二步】进入数据库

[ora11g@vm-kvm11820-app ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 4 09:50:09 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

 

 

【第三步】设置开始、结束时间点

SQL> exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();   #在加压后执行该指令设置开始时间点

SQL> exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();  #在加压结束后执行该指令设置结束时间点

 

【第四步】执行awrrpt.sql文件

SQL> @/DATA/opt/app/ora11g/product/11.2.0/rdbms/admin/awrrpt.sql

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

   DB Id    DB Name     Inst Num Instance
----------- ------------ -------- ------------
 2557964726 LDPBACKQ        1 ldpbackq


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: 

 

【第五步】

Enter value for report_type: html

Type Specified:  html


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

   DB Id     Inst Num DB Name       Instance    Host
------------ -------- ------------ ------------ ------------
* 2557964726        1 LDPBACKQ       ldpbackq    vm-kvm11820-
                        app

Using 2557964726 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.


Enter value for num_days: 
Enter value for num_days: 1      #1,当天

Listing the last day's Completed Snapshots

                            Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
ldpbackq     LDPBACKQ          11266 04 Apr 2019 00:00       1
                  11267 04 Apr 2019 01:00       1
                  11268 04 Apr 2019 02:00       1
                  11269 04 Apr 2019 03:00       1
                  11270 04 Apr 2019 04:00       1
                  11271 04 Apr 2019 05:00       1
                  11272 04 Apr 2019 06:00       1
                  11273 04 Apr 2019 07:00       1
                  11274 04 Apr 2019 08:00       1
                  11275 04 Apr 2019 09:00       1
                  11276 04 Apr 2019 09:47       1    #可以发现,此处有两个非整点的时间点,就是由之前第三步指令所生成的时间点
                  11277 04 Apr 2019 09:55       1



Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 
Enter value for begin_snap: 11276      #输入起始时间
Begin Snapshot Id specified: 11276

Enter value for end_snap: 11277      #结束时间
End   Snapshot Id specified: 11277



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

Enter value for report_name: 
Enter value for report_name: test.html    #为awr报告命名
......
Report written to test.html      #生成结束,请自行查找文件位置
SQL> 

 

posted on 2019-04-04 10:07  杂货铺已被占用  阅读(540)  评论(0编辑  收藏  举报

导航