(2)生成標(biāo)準(zhǔn)統(tǒng)計(jì)報(bào)表 |
[君三思] 2009-10-22 |
二、生成分析報(bào)表AWR 是通過(guò)對(duì)比兩次快照(snapshot)收集到的統(tǒng)計(jì)信息,來(lái)生成報(bào)表數(shù)據(jù),生成的報(bào)表包括多個(gè)部分,這點(diǎn)與Statspack生成的報(bào)告非常類似。不過(guò)AWR在生成報(bào)告時(shí),可以選擇生成TXT或HTML兩種格式的報(bào)告,相對(duì)來(lái)說(shuō),HTML更利于閱讀,而TXT的適用性更廣(即使在不能使用瀏覽器的機(jī)器上也能看)。 操作過(guò)Statspack的朋友都還記的,生成報(bào)告使用$ORACLE_HOME/rdbms/admin/spreport.sql腳本,到了AWR這片,操作步驟基本上相同,不過(guò)生成報(bào)告的腳本多了很多選擇,包括:
下面的章節(jié)中,我們就來(lái)一一例舉。
2.1 生成標(biāo)準(zhǔn)統(tǒng)計(jì)報(bào)表過(guò)程并不復(fù)雜,下列操作中加粗的部分,是需要指定值的位置(注意,執(zhí)行報(bào)表生成的用戶必須擁有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此處需指定生成的報(bào)表格式,有txt和html兩種選擇,默認(rèn)情況下為html格式,這里為演示起見(jiàn),輸入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 此處為要生成的報(bào)告指定一個(gè)文件名,默認(rèn)會(huì)根據(jù)前面輸入的snap_id生成一個(gè)文件名,比如這里生成的默認(rèn)文件名為awrrpt_1_7331_7355.html,當(dāng)然DBA可以根據(jù)實(shí)際情況對(duì)文件名進(jìn)行自定義。這里三思偷個(gè)懶,就用默認(rèn)文件名好了,直接回車(chē)。 接下來(lái)就不需要DBA再輸入什么了,等著ORACLE給你生成報(bào)表吧。 Using the report name awrrpt_1_7331_7355.html .................. .......................
End of Report Report written to awrrpt_1_7331_7355.html 打開(kāi)最終生成的統(tǒng)計(jì)報(bào)表,界面如下: 提示: 問(wèn):前面提示輸入snaps時(shí)哪來(lái)的這么多snapshots啊? 答:這都是ORACLE偷偷摸摸一點(diǎn)一點(diǎn)(每小時(shí)一次)收集的啊! 問(wèn):它究竟收集了多久的啊? 答:從當(dāng)前的記錄看,至少有7天了! 問(wèn):究竟啥是snapshot啊? 答:接著往下看! |