D:\app\lzhpc\product\11.2.0\dbhome_1\RDBMS\ADMIN\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
使用sqlplus导出报告:
1. 注意路径,执行sqlplus路径既是报告默认保存路径;
2. 注意用户,普通用户权限受限,可能无法生成报名;
过程
CMD==== >>
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\lzhpc># 测试oracle awr报告 “C:\Users\lzhpc” 该路径即为报告存放路径
C:\Users\lzhpc>sqlplus sys/orcl11R2@orcl as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期一 2月 20 18:09:39 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
1464224963 ORCL 1 orcl
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 的值: html
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 1464224963 1 ORCL orcl LZHPC11
Using 1464224963 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 的值: 1
Listing the last day's Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
orcl ORCL 1 20 2月 2017 12:00 1
2 20 2月 2017 13:51 1
3 20 2月 2017 15:00 1
4 20 2月 2017 16:00 1
5 20 2月 2017 17:00 1
6 20 2月 2017 18:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
输入 begin_snap 的值: 3
Begin Snapshot Id specified: 3
输入 end_snap 的值: 6
End Snapshot Id specified: 6
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_3_6.html. To use this name,
press <return> to continue, otherwise enter an alternative.
输入 report_name 的值:
Using the report name awrrpt_1_3_6.html
。。。。。。。。。中间大段输出代码省略
<p />
End of Report
</body></html>
Report written to awrrpt_1_3_6.html
SQL> quit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开
报告格式: