1、收集ash报告
[oracle@1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Fri Sep 21 18:43:01 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options
SQL> @?/rdbms/admin/ashrpt.sql
...
Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Press Enter to analyze till current time
Enter value for duration: 回车默认html格式
...
Defaults to -15 mins
Enter value for begin_time: 开始时间,回车默认十五分钟前 ,自定义格式:09/17/18 00:00:00
...
Press Enter to analyze till current time
Enter value for duration: 结束时间,回车默认但前时间,自定义格式:200 单位:分钟
...
The default report file name is ashrpt_1_0921_1853.html. To use this name,
press to continue, otherwise enter an alternative.
Enter value for report_name: 存放路径,回车默认为:/home/oracle/ashrpt_1_0921_1853.html
SQL> @?/rdbms/admin/ashrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
3435663478 NCDB 1 ncdb1
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type:
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 3435663478 1 NCDB ncdb1 ncdb01
3435663478 2 NCDB ncdb2 ncdb02
Defaults to current database
Using database id: 3435663478
Enter instance numbers. Enter 'ALL' for all instances in a
RAC cluster or explicitly specify list of instances (e.g., 1,2,3).
Defaults to current instance.
Using instance number(s): 1
ASH Samples in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oldest ASH sample available: 15-Jul-19 23:59:53 [ 12425 mins in the past]
Latest ASH sample available: 24-Jul-19 15:04:57 [ 0 mins in the past]
Specify the timeframe to generate the ASH report
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter begin time for report:
-- Valid input formats:
-- To specify absolute begin time:
-- [MM/DD[/YY]] HH24:MI[:SS]
-- Examples: 02/23/03 14:30:15
-- 02/23 14:30:15
-- 14:30:15
-- 14:30
-- To specify relative begin time: (start with '-' sign)
-- -[HH24:]MI
-- Examples: -1:15 (SYSDATE - 1 Hr 15 Mins)
-- -25 (SYSDATE - 25 Mins)
Defaults to -15 mins
Enter value for begin_time: 07/23/19 10:00:00
Report begin time specified: 07/23/19 10:00:00
Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Press Enter to analyze till current time
Enter value for duration: 150
Report duration specified: 150
Using 23-Jul-19 10:00:00 as report begin time
Using 23-Jul-19 12:30:00 as report end time
Specify Slot Width (using ashrpti.sql) for 'Activity Over Time' section
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Explanation:
-- In the 'Activity Over Time' section of the ASH report,
-- the analysis period is divided into smaller slots
-- and top wait events are reported in each of those slots.
-- Default:
-- The analysis period will be automatically split upto 10 slots
-- complying to a minimum slot width of
-- 1 minute, if the source is V$ACTIVE_SESSION_HISTORY or
-- 5 minutes, if the source is DBA_HIST_ACTIVE_SESS_HISTORY.
Specify Slot Width in seconds to use in the 'Activity Over Time' section:
Defaults to a value as explained above:
Slot Width specified:
Specify Report Targets (using ashrpti.sql) to generate the ASH report
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Explanation:
-- ASH Report can accept "Report Targets",
-- like a particular SQL statement, or a particular SESSION,
-- to generate the report on. If one or more report targets are
-- specified, then the data used to generate the report will only be
-- the ASH samples that pertain to ALL the specified report targets.
-- Default:
-- If none of the report targets are specified,
-- then the target defaults to all activity in the database instance.
Specify SESSION_ID (eg: from V$SESSION.SID) report target:
Defaults to NULL:
SESSION report target specified:
Specify SQL_ID (eg: from V$SQL.SQL_ID) report target:
Defaults to NULL: (% and _ wildcards allowed)
SQL report target specified:
Specify WAIT_CLASS name (eg: from V$EVENT_NAME.WAIT_CLASS) report target:
[Enter 'CPU' to investigate CPU usage]
Defaults to NULL: (% and _ wildcards allowed)
WAIT_CLASS report target specified:
Specify SERVICE_HASH (eg: from V$ACTIVE_SERVICES.NAME_HASH) report target:
Defaults to NULL:
SERVICE report target specified:
Specify MODULE name (eg: from V$SESSION.MODULE) report target:
Defaults to NULL: (% and _ wildcards allowed)
MODULE report target specified:
Specify ACTION name (eg: from V$SESSION.ACTION) report target:
Defaults to NULL: (% and _ wildcards allowed)
ACTION report target specified:
Specify CLIENT_ID (eg: from V$SESSION.CLIENT_IDENTIFIER) report target:
Defaults to NULL: (% and _ wildcards allowed)
CLIENT_ID report target specified:
Specify PLSQL_ENTRY name (eg: "SYS.DBMS_LOB.*") report target:
Defaults to NULL: (% and _ wildcards allowed)
PLSQL_ENTRY report target specified:
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is ashrpt_1_0723_1230.html. To use this name,
press
Enter value for report_name: ash19072322.htmml
2、收集awr报告
[oracle@1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Fri Sep 21 18:43:01 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options
SQL> @?/rdbms/admin/awrrpt.sql
...
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格式
...
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: 收集的时间段,单位:天
...
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 开始的snap ID
..
Enter value for end_snap: 结束的snap ID
...
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_269_271.html. To use this name,
press to continue, otherwise enter an alternative.
Enter value for report_name: 存放路径,回车默认为:/home/oracle/awrrpt_1_269_271.html
SQL> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
3435663478 NCDB 1 ncdb1
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:
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 3435663478 1 NCDB ncdb1 ncdb01
3435663478 2 NCDB ncdb2 ncdb02
Using 3435663478 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
specifying a number lists all completed snapshots.
Enter value for num_days: 2
Listing the last 2 days of Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
ncdb1 NCDB 8666 23 Jul 2019 00:00 1
8667 23 Jul 2019 01:00 1
8668 23 Jul 2019 02:00 1
8669 23 Jul 2019 03:00 1
8670 23 Jul 2019 04:00 1
8671 23 Jul 2019 05:00 1
8672 23 Jul 2019 06:00 1
8673 23 Jul 2019 06:59 1
8674 23 Jul 2019 08:00 1
8675 23 Jul 2019 09:00 1
8676 23 Jul 2019 10:00 1
8677 23 Jul 2019 11:00 1
8678 23 Jul 2019 12:00 1
8679 23 Jul 2019 13:00 1
8680 23 Jul 2019 14:00 1
8681 23 Jul 2019 15:00 1
8682 23 Jul 2019 16:00 1
8683 23 Jul 2019 16:59 1
8684 23 Jul 2019 18:00 1
8685 23 Jul 2019 19:00 1
8686 23 Jul 2019 20:00 1
8687 23 Jul 2019 21:00 1
8688 23 Jul 2019 22:00 1
8689 23 Jul 2019 23:00 1
8690 24 Jul 2019 00:00 1
8691 24 Jul 2019 01:00 1
8692 24 Jul 2019 02:00 1
8693 24 Jul 2019 03:00 1
8694 24 Jul 2019 04:00 1
8695 24 Jul 2019 05:00 1
8696 24 Jul 2019 06:00 1
8697 24 Jul 2019 07:00 1
8698 24 Jul 2019 08:00 1
8699 24 Jul 2019 09:00 1
8700 24 Jul 2019 10:00 1
8701 24 Jul 2019 11:00 1
8702 24 Jul 2019 12:00 1
8703 24 Jul 2019 13:00 1
8704 24 Jul 2019 14:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 8688
Begin Snapshot Id specified: 8688
Enter value for end_snap: 8689
End Snapshot Id specified: 8689
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_8688_8689.html. To use this name,
press
Enter value for report_name: awr2019072322.html