I. AWR usage
SQL> @? /Rdbms/admin/awrrpt. SQL
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Wocould you like an HTML report, or a plain text report?
Enter 'html' for an html report, or 'text' for plain text
Ults to 'html'
Enter the value of report_type:
Type Specified: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 <return>
Specifying a number lists all completed snapshots.
Enter the value of num_days:1
Listing the last day's Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
--------------------------------------------------------
Orcl10g ORCL10G 142 03 July 20 1
143 03, January 1, July 20
144 03 July 20 1
145 03 July 20 1
146 03 July 20 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter the begin_snap value:142
Begin Snapshot Id specified: 142
Enter the end_snap value:146
End Snapshot Id specified: 146
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_142_146.html. To use this name,
Press <return> to continue, otherwise enter an alternative.
Enter the value of report_name:/Home/Oracle/awrrpt_1_142_146.html
Report written to/home/oracle/awrrpt_1_142_146.html
Ii. AWR management
(1) Disable awr:
SQL>Exec dbms_workload_repository.modify_snapshot_settings (interval => 0 );
Note: If you set interval to 0, the awr function is disabled.
Verification:
SQL> select * from dba_hist_wr_control;
DBID SNAP_INTERVAL RETENTION TOPNSQL
----------------------------------------------------------
450641661 + 40150 00:00:00. 0 + 00008 00:00:00. 0 DEFAULT
(2) Open awr:
SQL>Exec dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 5*24*60 );
Note:The collection interval is 30 minutes and is retained for 5 days (in minutes)
If an error is reported during execution:
SQL> exec dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 5*24*60 );
BEGIN dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 5*24*60); END;
*
ERROR at line 1:
ORA-13541: system moving window baseline size (691200) greater than retention (432000)
ORA-06512: at "SYS. DBMS_WORKLOAD_REPOSITORY", line 89
ORA-06512: at "SYS. DBMS_WORKLOAD_REPOSITORY", line 137
ORA-06512: at line 1
The reason is that the baseline size (691200) set by the system is greater than the retention (432000) set at this time. There are two solutions:
Method 1: increase the retention value, that is, increase the retention days. For example, modify:
SQL> exec dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 9*24*60 );
PL/SQL procedure successfully completed.
Verification:
SQL> select * from dba_hist_wr_control;
DBID SNAP_INTERVAL RETENTION TOPNSQL
----------------------------------------------------------
450641661 + 00000 00:30:00. 0 + 00009 00:00:00. 0 DEFAULT
(3) view snapshot records:
Select * from sys. wrh $ _ active_session_history