學用ORACLE AWR和ASH特性(8)-生成ASH報表
五、生成ASH報表
V$ACTIVE_SESSION_HISTORY 檢視瀏覽起來確實方便,不過對於新手朋友其易用性就打了折扣,而且直觀性方面也不太好,幸好ORACLE也提供了相應的報表指令碼,可以生成指定的時間段內ASH相關的報表。
ORACLE 提供了兩個報表指令碼,即可以用來生成資料庫級的統計資訊,也可以針對RAC架構中某個例項在某個時間段的狀態生成統計,下面分別介紹。
1、生成指定時間段時的統計報表
生成資料庫級ASH統計報表使用ashrpt.sql指令碼,該檔案儲存在$ORACLE_HOME/rdbms/admin目錄下,基本上操作與AWR指令碼非常類似,例如:
SQL> @$ORACLE_HOME/rdbms/admin/ashrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
3812548755 TEST08 1 test08
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Enter ¨html¨ for an HTML report, or ¨text¨ for plain text
Defaults to ¨html¨
Enter value for report_type: html這裡讓選擇生成的報表型別,同樣是有html和text兩種,預設情況下為html型別。
選完型別後,接下來會顯示資料庫的一些基本資訊,包括ASH收集到的資訊的區間
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 3812548755 1 TEST08 test08 yans1
Defaults to current database
Using database id: 3812548755
Defaults to current instance
Using instance number: 1
ASH Samples in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oldest ASH sample available: 09-10 月-09 10:11:02 [ 38853 mins in the past]
Latest ASH sample available: 05-11 月-09 09:43:09 [ 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: -10輸入報表分析的開始時間,這裡即可以輸入一個時間型別的字串,比如09/23/2009 14:30:15,也可以直接輸入時間,甚至更簡單的,輸入一個負整數例如-10,表示當前時間前10分鐘做為開始時間。
Report begin time specified: -10
Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Press Enter to analyze till current time
Enter value for duration: 8然後要輸入統計的時間段,注意喲,不是讓輸入結束時間,而是說在前面輸入的開始時間的基礎上,希望收集多長時間內的資訊做統計,預設情況下為sysdate-begin_time,即從開始時間到當前時間,這裡為了顯的與眾不同,我就隨便敲了個8。
Report duration specified: 8
Using 05-11 月-09 09:33:44 as report begin time
Using 05-11 月-09 09:41:44 as report end time
........................
........................
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is ashrpt_1_1105_0941.html. To use this name,
press to continue, otherwise enter an alternative.
Enter value for report_name:輸入報表的名稱,預設會根據前面輸入的值來生成一個名稱,比如這裡預設生成的名稱為ashrpt_1_1105_0941.html。
Using the report name ashrpt_1_1105_0941.html
Summary of All User Input
-------------------------
Format : HTML
DB Id : 3812548755
Inst num : 1
Begin time : 05-11 月-09 09:33:44
End time : 05-11 月-09 09:41:44
Slot width : Default
Report targets : 0
Report name : ashrpt_1_1105_0941.html
報表成功生成,可以隨時開啟ashrpt_1_1105_0941.html瀏覽詳細資訊了。
2、生成指定資料庫例項的指定時間段時的統計報表
對於RAC架構的資料庫,有時候DBA可能會希望看到其中某個節點(或例項)的負載情況,這種情況下,可以使用ashwrpi.sql(附加的i應該是表示instance),例如:
SQL> @$ORACLE_HOME/rdbms/admin/ashrpti.sql
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Enter ¨html¨ for an HTML report, or ¨text¨ for plain text
Defaults to ¨html¨
Enter value for report_type: html選擇生成的報表檔案型別,仍然選擇html型別。
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
948405229 2 JSSDB jssdbn2 jssdbn2
* 948405229 1 JSSDB jssdbn1 jssdbn1
Defaults to current database
Enter value for dbid: 948405229這裡多了兩步,首先是要選擇資料庫的DBID,接下來是選擇例項ID。
Using database id: 948405229
Defaults to current instance
Enter value for inst_num: 1
Using instance number: 1
ASH Samples in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oldest ASH sample available: 15-Oct-09 21:24:53 [ 29499 mins in the past]
Latest ASH sample available: 05-Nov-09 09:00:56 [ 3 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:輸入開始的時間,後面的步驟與前面生成資料庫級的操作完全相同,不再演示。
前面介紹的這種種特性以及指令碼均是工具,工具永遠都只是起輔助的作用,能不能用好,還是取決於使用工具的人,祝好運吧。
全文完,下載pdf版本請至:http://www.5ienet.com/mydesign/article.asp?/html/rid/113.html
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7607759/viewspace-619571/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 學用ORACLE AWR和ASH特性(1)-ASH和AWR的故事Oracle
- 學用ORACLE AWR和ASH特性(4)-生成指定SQL的統計報表OracleSQL
- 學用ORACLE AWR和ASH特性(3)-生成指定資料庫例項的統計報表Oracle資料庫
- 學用ORACLE AWR和ASH特性(7)-AWR的幾個幫Oracle
- oracle awr ashOracle
- ASH可以生成指定的session或sql_id的報告,ASH和AWR的區別SessionSQL
- Oracle AWR與ASH效能報告深入解析Oracle
- Oracle10g ASH and AWROracle
- ORACLE AWR效能報告和ASH效能報告的解讀Oracle
- oracle實用sql(9)--批量生成一天的ash報告或awr報告OracleSQL
- ASH, AWR , 等待事件事件
- working with ASH and AWR
- AWR、ASH、ADDM和顧問程式
- oracle效能調憂工具AWR,ASH,ADDMOracle
- oracle ASHOracle
- Oracle 11g ASH報告的生成方法Oracle
- 自動生成ASH報告指令碼指令碼
- 轉載詳細的Oracle ASH/AWR介紹及報告分析Oracle
- [轉]Oracle資料庫ASH和AWR的簡單介紹Oracle資料庫
- statspack、awr、addm,ash影片分享
- Oracle10g AWR及ASH詳解(final)Oracle
- ASH、AWR、ADDM區別聯絡
- statspack、awr、addm,ash視訊分享
- Oracle ASH和Session Tracing(ZT)OracleSession
- Oracle效能調整的三把利劍--ASH,AWR,ADDMOracle
- Oracle 11g 手工跑ASH報告Oracle
- oracle ash效能報告的使用方法Oracle
- 10G新特性筆記之AWR,ASH,METRIC,ALERT&ADVISOR筆記
- In 10g/11g,working with ASH and AWR
- ASH buffers 資料取樣到AWR的問題
- Oracle AWR與ASH效能報告深入解析-核心引數詳解-手操-圖文-可下載Oracle
- 【筆記】ash筆記
- Oracle生成awr報告Oracle
- Oracle 生成awr報告Oracle
- 循序漸進Oracle - 全面認識Oracle ASHOracle
- Active Session History (ASH)Session
- 【AWR】Oracle批量生成awr報告指令碼Oracle指令碼
- 【kingsql分享】ASH的研究和分析SQL