1,登录oracle服务端

2,切换至oracle用户

su - oracle

3,多实例需要切换至对应实例

       3.1.查看实例方法如下

         oracle@db02[/app/oracle]$ps -ef|grep smon
         oracle    54102      1  2 Dec24 ?        02:32:00 ora_smon_aaaa
         grid     144900      1  0 Dec13 ?        00:00:18 asm_smon_+ASM
         oracle   145532      1  0 Dec13 ?        00:01:23 ora_smon_bb
         oracle   179758 179473  0 10:08 pts/1    00:00:00 grep --color=auto smon

       3.2.比如此次导出的awr报告为bb,则切换实例至bb

           export  ORACLE_SID=bb

4.以管理员用户登入数据库

         sqlplus / as sysdba

5,执行如下命令@?/rdbms/admin/awrrpt.sql

SQL> @?/rdbms/admin/awrrpt.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: html #输入awr报告输出的类型,按上述三种类型填写
old   1: select 'Type Specified: ',lower(nvl('&&report_type','html')) report_type from dual
new   1: select 'Type Specified: ',lower(nvl('html','html')) report_type from dual

Type Specified:  html

old   1: select '&&report_type' report_type_def from dual
new   1: select 'html' report_type_def from dual

old   1: select '&&view_loc' view_loc_def from dual
new   1: select 'AWR_PDB' view_loc_def from dual

Current Instance
~~~~~~~~~~~~~~~~
DB Id          DB Name        Inst Num       Instance       Container Name
-------------- -------------- -------------- -------------- --------------
 2198676206     BB                         1 BB            bb


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DB Id      Inst Num   DB Name      Instance     Host
------------ ---------- ---------    ----------   ------
* 2198676206     1      BB          BB          db02

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


Enter value for num_days: 1 #获取awr数据的天数

Listing the last day's Completed Snapshots
Instance     DB Name      Snap Id       Snap Started    Snap Level
------------ ------------ ---------- ------------------ ----------

BB          BB               2437  29 Dec 2018 00:00    1
                               2438  29 Dec 2018 01:00    1
                               2439  29 Dec 2018 02:00    1
                               2440  29 Dec 2018 03:00    1
                               2441  29 Dec 2018 04:00    1
                               2442  29 Dec 2018 05:00    1
                               2443  29 Dec 2018 06:00    1
                               2444  29 Dec 2018 07:00    1
                               2445  29 Dec 2018 08:00    1
                               2446  29 Dec 2018 09:00    1
                               2447  29 Dec 2018 10:00    1


Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 2437 #通过上述产寻到的ID,确定需要导出开始时间点的id
Begin Snapshot Id specified: 2437

Enter value for end_snap: 2447 #通过上述产寻到的ID,确定需要导出结束时间点的id
End   Snapshot Id specified: 2447

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

Enter value for report_name:#配置导出awr报告的名字,如果未配置则使用上述说明的默认名字awrrpt_1_2437_2447.html

出现如下说明,则导出awr完成

End of Report
Report written to awrrpt_1_2437_2447.html

Logo

更多推荐