(2)生成標準統(tǒng)計報表 |
[君三思] 2009-10-22 |
二、生成分析報表AWR 是通過對比兩次快照(snapshot)收集到的統(tǒng)計信息,來生成報表數(shù)據(jù),生成的報表包括多個部分,這點與Statspack生成的報告非常類似。不過AWR在生成報告時,可以選擇生成TXT或HTML兩種格式的報告,相對來說,HTML更利于閱讀,而TXT的適用性更廣(即使在不能使用瀏覽器的機器上也能看)。 操作過Statspack的朋友都還記的,生成報告使用$ORACLE_HOME/rdbms/admin/spreport.sql腳本,到了AWR這片,操作步驟基本上相同,不過生成報告的腳本多了很多選擇,包括:
下面的章節(jié)中,我們就來一一例舉。
2.1 生成標準統(tǒng)計報表過程并不復雜,下列操作中加粗的部分,是需要指定值的位置(注意,執(zhí)行報表生成的用戶必須擁有DBA角色): JSSWEB> @$ORACLE_HOME/rdbms/admin/awrrpt.sql Current Instance ~~~~~~~~~~~~~~~~ DB Id DB Name Inst Num Instance ----------- ------------ -------- ------------ 3812548755 TEST08 1 test08 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此處需指定生成的報表格式,有txt和html兩種選擇,默認情況下為html格式,這里為演示起見,輸入html。 Type Specified: html Instances in this Workload Repository schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB Id Inst Num DB Name Instance Host ------------ -------- ------------ ------------ ------------ * 3812548755 1 TEST08 test08 yans1 Using 3812548755 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此處需指定要讀取多少天內(nèi)的快照信息! Listing the last 2 days of Completed Snapshots Snap Instance DB Name Snap Id Snap Started Level ------------ ------------ --------- ------------------ ----- test08 TEST08 7330 20 10 月 2009 00:00 1 7331 20 10 月 2009 01:00 1 7332 20 10 月 2009 02:00 1 7333 20 10 月 2009 03:00 1 7334 20 10 月 2009 04:00 1 7335 20 10 月 2009 05:01 1 7336 20 10 月 2009 06:00 1 7337 20 10 月 2009 07:01 1 7338 20 10 月 2009 08:00 1 7339 20 10 月 2009 09:00 1 7340 20 10 月 2009 10:00 1 7341 20 10 月 2009 11:00 1 7342 20 10 月 2009 12:00 1 7343 20 10 月 2009 13:00 1 7344 20 10 月 2009 14:00 1 7345 20 10 月 2009 15:00 1 7346 20 10 月 2009 16:00 1 7347 20 10 月 2009 17:00 1 7348 20 10 月 2009 18:00 1 7349 20 10 月 2009 19:00 1 7350 20 10 月 2009 20:00 1 7351 20 10 月 2009 21:00 1 7352 20 10 月 2009 22:00 1 7353 20 10 月 2009 23:00 1 7354 21 10 月 2009 00:00 1 7355 21 10 月 2009 01:00 1 7356 21 10 月 2009 02:00 1 7357 21 10 月 2009 03:00 1 7358 21 10 月 2009 04:00 1 7359 21 10 月 2009 05:00 1 7360 21 10 月 2009 06:00 1 7361 21 10 月 2009 07:00 1 7362 21 10 月 2009 08:00 1 7363 21 10 月 2009 09:00 1 7364 21 10 月 2009 10:00 1 7365 21 10 月 2009 11:00 1 7366 21 10 月 2009 12:00 1 7367 21 10 月 2009 13:00 1 7368 21 10 月 2009 14:00 1 Specify the Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap: 7331 Begin Snapshot Id specified: 7331 Enter value for end_snap: 7355 End Snapshot Id specified: 7355 Specify the Report Name ~~~~~~~~~~~~~~~~~~~~~~~ The default report file name is awrrpt_1_7331_7355.html. To use this name, press 此處為要生成的報告指定一個文件名,默認會根據(jù)前面輸入的snap_id生成一個文件名,比如這里生成的默認文件名為awrrpt_1_7331_7355.html,當然DBA可以根據(jù)實際情況對文件名進行自定義。這里三思偷個懶,就用默認文件名好了,直接回車。 接下來就不需要DBA再輸入什么了,等著ORACLE給你生成報表吧。 Using the report name awrrpt_1_7331_7355.html .................. .......................
End of Report Report written to awrrpt_1_7331_7355.html 打開最終生成的統(tǒng)計報表,界面如下: 提示: 問:前面提示輸入snaps時哪來的這么多snapshots啊? 答:這都是ORACLE偷偷摸摸一點一點(每小時一次)收集的啊! 問:它究竟收集了多久的啊? 答:從當前的記錄看,至少有7天了! 問:究竟啥是snapshot啊? 答:接著往下看! |