生产AWR,最简单的步骤!入门参考

 

 

    --产生整个数据库的AWR报告,运行脚本awrrpt.sql。

   @?/rdbms/admin/awrrpt.sql

    --产生某个实例的AWR报告,运行脚本awrrpti.sql。

   @?/rdbms/admin/awrrpti.sql

    --产生某条SQL语句的AWR报告,运行脚本awrsqrpt.sql。

   @?/rdbms/admin/awrsqrpt.sql

--注: $ORACLE_HOME代表Oracle的主目录。

 

示例:产生整个数据库的AWR报告。本例中,Oracle的主目录是
S:\app\Administrator\product\11.2.0\dbhome_1

运行脚本awrrpt.sql。

SQL> @?/rdbms/admin/awrrpt.sql

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

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1337234614 ORCL                1 orcl


选择报告的类型。

   0. 输入 report_type 的值:  html

本例中选择HTML。


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

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

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 1337234614        1 ORCL         orcl         JINRI185

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

 


列出最近两天产生的快照(主要是获得快照ID)

   1. 输入 num_days 的值:  2 

Listing the last 2 days of Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
orcl         ORCL              1064 21 4月  2013 00:00     1
                               1065 21 4月  2013 01:00     1
                               1066 21 4月  2013 02:00     1
                               1067 21 4月  2013 03:00     1
                               1068 21 4月  2013 04:00     1
                               1069 21 4月  2013 05:00     1
                               1070 21 4月  2013 06:00     1
                               1071 21 4月  2013 07:00     1
                               1072 21 4月  2013 08:00     1
                               1073 21 4月  2013 09:00     1
                               1074 21 4月  2013 10:00     1
                               1075 21 4月  2013 11:00     1
                               1076 21 4月  2013 12:00     1
                               1077 21 4月  2013 13:00     1
                               1078 21 4月  2013 14:00     1
                               1079 21 4月  2013 15:00     1
                               1080 21 4月  2013 16:00     1
                               1081 21 4月  2013 17:00     1
                               1082 21 4月  2013 18:00     1
                               1083 21 4月  2013 19:00     1
                               1084 21 4月  2013 20:00     1
                               1085 21 4月  2013 21:01     1
                               1086 21 4月  2013 22:00     1
                               1087 21 4月  2013 23:00     1
                               1088 22 4月  2013 00:00     1
                               1089 22 4月  2013 01:01     1
                               1090 22 4月  2013 02:00     1
                               1091 22 4月  2013 03:00     1
                               1092 22 4月  2013 04:00     1
                               1093 22 4月  2013 05:00     1
                               1094 22 4月  2013 06:00     1
                               1095 22 4月  2013 07:00     1
                               1096 22 4月  2013 08:00     1
                               1097 22 4月  2013 09:00     1
                               1098 22 4月  2013 10:00     1
                               1099 22 4月  2013 11:00     1
                               1100 22 4月  2013 12:00     1
                               1101 22 4月  2013 13:00     1
                               1102 22 4月  2013 14:00     1

 

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

输入 end_snap 的值:   1076

 


指定报告的名字。

输入 report_name 的值:  s:/ocpyang.html

 //******** 常见错误

注意:输入报告名后回车出现 ORA-00904:: invalid identified value
解决办法:用sys用户来执行或者对用户进行授权 grant all on dbms_workload_repository to perfstat;

**********//

 

@?/rdbms/admin/