最近由于数据库cpu占用非常高,导致VCS常常自动切换,引起很多问题。 最近学习一下数据库awr分析数据库sql执行性能的分析报告。下面将初步讲解一下: 1、先登陆数据库,生成awr报告。 linux:~ # su - oracle
oracle@linux:~> sqlplus '/as sysdba'
SQL*Plus: Release 11.1.0.6.0 - Production on Sun Apr 7 14:02:38 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2、输入分析命令
SQL> @?/rdbms/admin/awrrpt
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
2045388596 UTF8 1 utf8
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
3、输入要生成报告的文件格式
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 2045388596 1 UTF8 utf8 linux
Using 2045388596 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.
4、输入要生成报告相隔的天数
Enter value for num_days: 1
Listing the last day's Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
utf8 UTF8 2809 26 Oct 2014 00:00 1
2810 26 Oct 2014 01:00 1
2811 26 Oct 2014 02:00 1
2812 26 Oct 2014 03:00 1
2813 26 Oct 2014 04:00 1
2814 26 Oct 2014 05:00 1
2815 26 Oct 2014 06:00 1
2816 26 Oct 2014 07:00 1
2817 26 Oct 2014 08:00 1
2818 26 Oct 2014 09:00 1
2819 26 Oct 2014 10:00 1
2820 26 Oct 2014 11:00 1
2821 26 Oct 2014 12:00 1
5、输入相隔的快照之间的Snap Id开始号和结束号
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 2809
Enter value for end_snap: 2821
End Snapshot Id specified: 2821
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_2809_2821.html. To use this name,
press <return> to continue, otherwise enter an alternative.
6、输入生成报告的名字:
Enter value for report_name: 20130407awr.html
|