您好,登錄后才能下訂單哦!
這篇文章主要介紹“分析Oracle AWR報告”,在日常操作中,相信很多人在分析Oracle AWR報告問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”分析Oracle AWR報告”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
ORACLE10G之后,awr就是oracle內部的一個組件了;
報告不能包括數據庫啟停動作
1.控制awr機制的參數,統計信息級別
SYS@orcl11g> show parameter statistics_level
NAME TYPE VALUE
------------------------------------ ----------- -------------
statistics_level string TYPICAL
statistics_level:
basic --關閉awr
typical --典型的
all --收集更加細致的信息
SYS@orcl11g> select STATISTICS_NAME ,ACTIVATION_LEVEL from V$STATISTICS_LEVEL;
STATISTICS_NAME ACTIVAT
---------------------------------------------------------------- -------------
Buffer Cache Advice TYPICAL
MTTR Advice TYPICAL
Timed Statistics TYPICAL
Timed OS Statistics ALL
Segment Level Statistics TYPICAL
PGA Advice TYPICAL
Plan Execution Statistics ALL
Shared Pool Advice TYPICAL
Modification Monitoring TYPICAL
Longops Statistics TYPICAL
Bind Data Capture TYPICAL
Ultrafast Latch Statistics TYPICAL
Threshold-based Alerts TYPICAL
Global Cache Statistics TYPICAL
Global Cache CPU Statistics ALL
Active Session History TYPICAL
Undo Advisor, Alerts and Fast Ramp up TYPICAL
Streams Pool Advice TYPICAL
Time Model Events TYPICAL
Plan Execution Sampling TYPICAL
Automated Maintenance Tasks TYPICAL
SQL Monitoring TYPICAL
Adaptive Thresholds Enabled TYPICAL
V$IOSTAT_* statistics TYPICAL
24 rows selected.
2.awr信息的保留時長,以及awr快照收集的時間間隔
默認awr信息保留時間為8天,快照收集的時間間隔為:1小時,快照保存在sysaux表空間;
--修改的命令:
begin DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(12960,30); end;
--表明將保留時長設置為:60*24*9 = 12960,快照收集時間間隔設置為30分鐘;
SYS@orcl11g>
select * from dba_hist_wr_control
DBID SNAP_INTERVAL RETENTION TOPNSQL
--------------- ------------------------------ ------------------------------ ---------------
971282091 +00000 00:30:00.0 +00009 00:00:00.0 DEFAULT
自動動調整 保存時間 是8天,以上修改命令要大于8天才能執行,10g中是7天
3.生成awr報告
[oracle@memory admin]$ pwd
/u01/app/oracle/product/11.2.0/db_home1/rdbms/admin
[oracle@db253 admin]$ ls awr*
awrblmig.sql awrextr.sql awrginp.sql awrinpnm.sql awrrpt.sql
awrddinp.sql awrgdinp.sql awrgrpti.sql awrinput.sql awrsqrpi.sql
awrddrpi.sql awrgdrpi.sql awrgrpt.sql awrload.sql awrsqrpt.sql
awrddrpt.sql awrgdrpt.sql awrinfo.sql awrrpti.sql
SYS@orcl11g> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------------- -------------- ------------ ------------
915341431 ORCL11G 1 orcl11g
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
。。。。。
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
----------------- -------------- -------------- ------------ ---------------------------
* 915341431 1 ORCL11G orcl11g g11252.neves.com
Using 915341431 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:
2 --顯示最近2天的快照信息,生成報告時使用的快照不能跨越數據庫啟停動作.
Listing the last 2 days of Completed Snapshots
Instance DB Name Snap Id Snap Started Snap Level
------------ -------------- --------- ------------------------- --------------
orcl11g ORCL11G 2 27 Mar 2013 09:52 1
3 27 Mar 2013 11:00 1
4 27 Mar 2013 12:00 1
5 27 Mar 2013 13:00 1
6 27 Mar 2013 14:00 1
7 27 Mar 2013 15:00 1
8 27 Mar 2013 16:00 1
9 27 Mar 2013 17:00 1
10 28 Mar 2013 09:17 1
11 28 Mar 2013 10:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 3
Begin Snapshot Id specified: 3
Enter value for end_snap: 5 --跨越時間越久,越容易掩蓋一些問題,一些問題會由于時間長而稀釋掉
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_3_5.html. To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name: /home/oracle/awr_3_5.html
***********************************************************************************************************
查看當前的AWR(automatic workload repository)保存策略:
col SNAP_INTERVAL format a20
col RETENTION format a20
select * from dba_hist_wr_control;
查看AWR的快照ID
SELECT SNAP_ID,
to_char(BEGIN_INTERVAL_TIME,'yyyy-mm-dd hh34:mi:ss') BEGIN_INTERVAL_TIME,
to_char(STARTUP_TIME,'yyyy-mm-dd hh34:mi:ss') STARTUP_TIME
FROM dba_hist_snapshot ORDER BY 1;
用 sys 之外的用戶(SCOTT) 創建 AWR 報告:
CONNECT / AS SYSDBA
GRANT ADVISOR TO SCOTT;
GRANT SELECT_CATALOG_ROLE TO SCOTT;
GRANT EXECUTE ON sys.dbms_workload_repository TO SCOTT;
手動創建快照:
SYS@prod>exec dbms_workload_repository.create_snapshot;
到此,關于“分析Oracle AWR報告”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。