【第一步】找到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 sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 4 09:50:09 2019Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>
【第三步】设置开始、结束时间点
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.sqlCurrent Instance~~~~~~~~~~~~~~~~ DB Id DB Name Inst Num Instance----------- ------------ -------- ------------ 2557964726 LDPBACKQ 1 ldpbackqSpecify the Report Type~~~~~~~~~~~~~~~~~~~~~~~Would you like an HTML report, or a plain text report?Enter 'html' for an HTML report, or 'text' for plain textDefaults to 'html'Enter value for report_type:
【第五步】
Enter value for report_type: htmlType Specified: htmlInstances in this Workload Repository schema~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB Id Inst Num DB Name Instance Host------------ -------- ------------ ------------ ------------* 2557964726 1 LDPBACKQ ldpbackq vm-kvm11820- appUsing 2557964726 for database IdUsing 1 for instance numberSpecify 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. Pressingwithoutspecifying 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 SnapInstance 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 1Specify the Begin and End Snapshot Ids~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Enter value for begin_snap:
Enter value for begin_snap: 11276 #输入起始时间Begin Snapshot Id specified: 11276Enter value for end_snap: 11277 #结束时间End Snapshot Id specified: 11277Specify the Report Name~~~~~~~~~~~~~~~~~~~~~~~The default report file name is awrrpt_1_11276_11277.html. To use this name,pressto continue, otherwise enter an alternative.Enter value for report_name:
Enter value for report_name: test.html #为awr报告命名......Report written to test.html #生成结束,请自行查找文件位置SQL>