本文介绍了Oracle如何为各种目的生成AWR报告。 你应该知道DBA可以生成两种类型的AWR报告。 一个是单实例报告,另一个是集群数据库报告。
什么是自动工作量资料档案库(AWR )? AWR是存储与Oracle数据库性能相关的静态信息的位置。 自动数据库诊断监视器(ADDM )是一种诊断工具,用于分析AWR数据,并为数据库系统的所有发现提供建议。 该功能称为“自动性能诊断”。
为单实例数据库生成AWR报告
对于单实例数据库报告,必须运行AWRrpt.sql生成awr报告。
SQL @? /rdbms/admin/awrrpt.sql
当前实例
~~~~~~~~~~~~~ ~
DB Id DB Name Inst Num Instance
-------------请参阅
933515296 COMPDB 1 primdb
特定the报告类型
~~~~~~~~~~。 是~ ~。
Would you like an HTML report,or a plain文本报告?
Enter 'html' for an HTML report,or 'text' for plain text
Defaults to 'html '
entervalueforreport _ type : html
类型特定: html
instancesinthisworkloadrepositoryschema
~~~~~~~~~~~~~~~~~~~~~ ~
DB Id Inst Num DB Name Instance Host
------------- -请参阅
* 9335152961 compdbprimdbprimary 01.ex
ample.com
Using 933515296 for database Id
Using 1 for instance number
specifythenumberofdaysofsnapshotstochoosefrom
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
enteringthenumberofdays(n ) will result in the most recent
(n ) daysofsnapshotsbeinglisted.pressing without
specifyinganumberlistsallcompletedsnapshots。
Enter value for num_days:
列出所有已完成快照s
快照
instancedbnamesnapidsnapstartedlevel
------------- -请参阅
primdbcompdb 504 feb 2016093360101
6 04 Feb 2016 10:00 1
7 04 Feb 2016 11:00 1
8 04 Feb 2016 12:00 1
9 04 Feb 2016 13:00 1
10 04 Feb 2016 14:00 1
specifythebeginandendsnapshotids
~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 7
Begin Snapshot Id specified: 7
Enter value for end_snap: 8
最终快照id特定: 8
Specify the Report Name
~~~~~~~~~~。 是~ ~。
the default报告文件名称
is awrrpt_1_7_8.html. To use this name,press to continue, otherwise enter an alternative.
Enter value for report_name:
Using the report name awrrpt_1_7_8.html
AWR Report for DB: COMPDB, Inst: primdb, Snaps: 7-8...
Report written to awrrpt_1_7_8.html
SQL> !
[oracle@primary01 ~]$ ll
...
-rw-r--r--. 1 oracle oinstall 533219 Feb 4 14:12 awrrpt_1_7_8.html
[oracle@primary01 ~]$ exit
...
其中,@(符号)表示它从以下字符串开始执行。?(问号)表示$ORACLE_HOME。有关更多说明,您可以参考这篇文章:Oracle数据库中使用了哪些符号?
生成群集数据库的AWR报告
生成AWR报告有两种基本类型,一种是特定于实例级别的,另一种特定于数据库级别的。
实例级
对于实例级报告,您必须运行awrrpti.sql一次生成一个AWR报告。在这种情况下,我们选择实例2作为报告的主要来源。
SQL> @?/rdbms/admin/awrrpti.sql
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats. Please enter the
name of the format at the prompt. Default value is 'html'.
'html' HTML format (default)
'text' Text format
'active-html' Includes Performance Hub active report
Enter value for report_type:
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 3240481230 1 ERPFINDB erpfindb1 rac1
3240481230 2 ERPFINDB erpfindb2 rac2
Enter value for dbid: 3240481230
Using 3240481230 for database Id
Enter value for inst_num: 2
Using 2 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: 8
Listing the last 8 days of Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
erpfindb1 ERPFINDB 83611 16 Apr 2019 00:00 1
...
...
83679 23 Apr 2019 00:00 1
...
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 83611
Begin Snapshot Id specified: 83611
Enter value for end_snap: 83679
End Snapshot Id specified: 83679
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_2_83611_83679.html. To use this name,
press to continue, otherwise enter an alternative.
Enter value for report_name: awr_instance_2_report_20190423.html
...
全局级别
对于全局级别的报告,必须运行awrgrpt.sql才能为群集数据库全局生成AWR报告。
SQL> @?/rdbms/admin/awrgrpt.sql
Current Database
~~~~~~~~~~~~~~~~
DB Id DB Name
----------- ------------
3240481230 ERPFINDB
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats. Please enter the
name of the format at the prompt. Default value is 'html'.
'html' HTML format (default)
'text' Text format
'active-html' Includes Performance Hub active report
Enter value for report_type:
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id INSTT_NUM DB Name
------------ ---------- ------------
INSTT_NAME Host
------------------------------------------------ ------------
* 3240481230 1 ERPFINDB
erpfindb1 rac1
* 3240481230 2 ERPFINDB
erpfindb2 rac2
Using 3240481230 for database Id
Using instances ALL (default 'ALL')
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: 8
Listing the last 8 days of Completed Snapshots
Snap
DB Name Snap Id Snap Started Level
------------ --------- ------------------ -----
ERPFINDB 83611 16 Apr 2019 00:00 1
...
...
83679 23 Apr 2019 00:00 1
...
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 83611
Begin Snapshot Id specified: 83611
Enter value for end_snap: 83679
End Snapshot Id specified: 83679
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_rac_83611_83679.html. To use this name,
press to continue, otherwise enter an alternative.
Enter value for report_name: awr_global_database_report_20190423.html
...
报告范围的差异
让我们总结一下SQL脚本之间统计范围的差异,如下图所示。
序号脚本范围
1awrrpt.sql当前实例
2awrrpti.sql选定的实例
3awrgrpt.sql整个集群数据库,
包括所有实例
尽管我们使用awrgrpt.sql为整个群集数据库生成AWR报告,但是我们可以拥有由awrrpti.sql生成的更详细的实例AWR报告。
标签:AWR,value,生成,------------,report,html,Enter,Oracle
来源: https://blog.csdn.net/allway2/article/details/110227990