Chinaunix首页 | 论坛 | 博客
  • 博客访问: 621895
  • 博文数量: 28
  • 博客积分: 6060
  • 博客等级: 准将
  • 技术积分: 1948
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-03 08:55
文章分类

全部博文(28)

文章存档

2011年(3)

2009年(9)

2008年(16)

我的朋友

分类: Oracle

2008-05-17 12:06:49

一直以为awr报告是statspack的替代品,其实在10g中你可以选择使用statspack还是awr,这两者是
同时存在的,而不是一者是另一者的替代。正是因为这个替代关系,所以在实际工作中,就产生了一个错误。

下面为演示过程,后面有一个小小的总结:

SQL> conn perfstat/perfstat
Connected.
SQL> @?/rdbms/admin/awrrpt.sql

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

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1174647572 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'
Enter value for report_type: html

Type Specified:  html


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

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 1174647572        1 ORCL         orcl         localhost

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


Enter value for num_days: 1

Listing the last day's Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
orcl         ORCL              1835 17 May 2008 00:00      1
                               1836 17 May 2008 01:00      1
                               1837 17 May 2008 02:00      1
                               1838 17 May 2008 03:00      1
                               1839 17 May 2008 04:00      1
                               1840 17 May 2008 05:00      1
                               1841 17 May 2008 06:00      1
                               1842 17 May 2008 07:00      1
                               1843 17 May 2008 08:00      1
                               1844 17 May 2008 09:00      1
                               1845 17 May 2008 10:00      1
                               1846 17 May 2008 11:00      1



Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1845
Begin Snapshot Id specified: 1845

Enter value for end_snap: 1846
End   Snapshot Id specified: 1846



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

Enter value for report_name:

Using the report name awrrpt_1_1845_1846.html
select output from table(dbms_workload_repository.awr_report_html( :dbid,
                         *
ERROR at line 1:
ORA-00904: : invalid identifier


Report written to awrrpt_1_1845_1846.html
SQL> conn /as sysdba
Connected.
SQL> @?/rdbms/admin/awrrpt.sql

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

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1174647572 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'
Enter value for report_type: html

Type Specified:  html


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

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 1174647572        1 ORCL         orcl         localhost

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


Enter value for num_days: 1

Listing the last day's Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
orcl         ORCL              1835 17 May 2008 00:00      1
                               1836 17 May 2008 01:00      1
                               1837 17 May 2008 02:00      1
                               1838 17 May 2008 03:00      1
                               1839 17 May 2008 04:00      1
                               1840 17 May 2008 05:00      1
                               1841 17 May 2008 06:00      1
                               1842 17 May 2008 07:00      1
                               1843 17 May 2008 08:00      1
                               1844 17 May 2008 09:00      1
                               1845 17 May 2008 10:00      1
                               1846 17 May 2008 11:00      1



Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1845
Begin Snapshot Id specified: 1845

Enter value for end_snap: 1846
End   Snapshot Id specified: 1846



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

Enter value for report_name:

Using the report name awrrpt_1_1845_1846.html

产生报告的过程省略......
Report written to awrrpt_1_1845_1846.html



总结

原以为awr报告是statspack的替代品,所以从而想当然产生awr报告是在perfstat用户下,其实实际并不是如此,产生awr报告需要sys用户来做。
阅读(1871) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~