(5)生成不同時間內(nèi)的對比統(tǒng)計報表 |
[君三思] 2009-11-4 |
2.5 生成不同時間段時的統(tǒng)計對比報表在沒有awr之前,如果希望對不同時間段時,數(shù)據(jù)庫的整體影響進行對比,只能依靠DBA手工查詢相關(guān)視圖,并通過時間條件來獲取差異(還有些統(tǒng)計已經(jīng)無法對比),而在AWR中,直接就提供了,對不同時間段時,數(shù)據(jù)庫的性能統(tǒng)計做差異對比的功能。 執(zhí)行腳本如下: SQL> @$ORACLE_HOME/rdbms/admin/awrddrpt.sql Current Instance ~~~~~~~~~~~~~~~~ DB Id DB Id DB Name Inst Num Inst Num Instance ----------- ----------- ------------ -------- -------- ------------ 3812548755 3812548755 TEST08 1 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生成的報表格式,沒啥說的,就默認的html格式吧。 Type Specified: html Instances in this Workload Repository schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB Id Inst Num DB Name Instance Host ------------ -------- ------------ ------------ ------------ * 3812548755 1 TEST08 test08 yans1 Database Id and Instance Number for the First Pair of Snapshots ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Using 3812548755 for Database Id for the first pair of snapshots Using 1 for Instance Number for the first pair of snapshots注意,下面緊接著,是選擇第一份報表的相關(guān)參數(shù),包括快照的區(qū)間,以及開始和結(jié)束的快照ID: 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 Listing the last 2 days of Completed Snapshots Snap Instance DB Name Snap Id Snap Started Level ------------ ------------ --------- ------------------ ----- test08 TEST08 7450 25 10 月 2009 00:00 1 7451 25 10 月 2009 01:00 1 7452 25 10 月 2009 02:00 1 7453 25 10 月 2009 03:00 1 7454 25 10 月 2009 04:00 1 7455 25 10 月 2009 05:00 1 7456 25 10 月 2009 06:00 1 7457 25 10 月 2009 07:00 1 7458 25 10 月 2009 08:00 1 7459 25 10 月 2009 09:00 1 7460 25 10 月 2009 10:00 1 7461 25 10 月 2009 11:00 1 7462 25 10 月 2009 12:00 1 7463 25 10 月 2009 13:00 1 7464 25 10 月 2009 14:00 1 7465 25 10 月 2009 15:00 1 7466 25 10 月 2009 16:00 1 7467 25 10 月 2009 17:00 1 7468 25 10 月 2009 18:00 1 7469 25 10 月 2009 19:00 1 7470 25 10 月 2009 20:00 1 7471 25 10 月 2009 21:00 1 7472 25 10 月 2009 22:00 1 7473 25 10 月 2009 23:00 1 7474 26 10 月 2009 00:00 1 7475 26 10 月 2009 01:00 1 7476 26 10 月 2009 02:00 1 7477 26 10 月 2009 03:00 1 7478 26 10 月 2009 04:00 1 7479 26 10 月 2009 05:00 1 7480 26 10 月 2009 06:00 1 7481 26 10 月 2009 07:00 1 7482 26 10 月 2009 08:00 1 7483 26 10 月 2009 09:00 1 7484 26 10 月 2009 10:00 1 7485 26 10 月 2009 11:00 1 7486 26 10 月 2009 12:00 1 7487 26 10 月 2009 13:00 1 7488 26 10 月 2009 14:00 1 7489 26 10 月 2009 15:00 1 Specify the First Pair of Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap: 7459 First Begin Snapshot Id specified: 7459 Enter value for end_snap: 7462 First End Snapshot Id specified: 7462然后,是選擇要對比的報表相關(guān)參數(shù),包括快照的區(qū)間,以及開始和結(jié)束的快照ID: Instances in this Workload Repository schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB Id Inst Num DB Name Instance Host ------------ -------- ------------ ------------ ------------ * 3812548755 1 TEST08 test08 yans1 Database Id and Instance Number for the Second Pair of Snapshots ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Using 3812548755 for Database Id for the second pair of snapshots Using 1 for Instance Number for the second pair of snapshots 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_days2: 2 Listing the last 2 days of Completed Snapshots Snap Instance DB Name Snap Id Snap Started Level ------------ ------------ --------- ------------------ ----- test08 TEST08 7450 25 10 月 2009 00:00 1 7451 25 10 月 2009 01:00 1 7452 25 10 月 2009 02:00 1 7453 25 10 月 2009 03:00 1 7454 25 10 月 2009 04:00 1 7455 25 10 月 2009 05:00 1 7456 25 10 月 2009 06:00 1 7457 25 10 月 2009 07:00 1 7458 25 10 月 2009 08:00 1 7459 25 10 月 2009 09:00 1 7460 25 10 月 2009 10:00 1 7461 25 10 月 2009 11:00 1 7462 25 10 月 2009 12:00 1 7463 25 10 月 2009 13:00 1 7464 25 10 月 2009 14:00 1 7465 25 10 月 2009 15:00 1 7466 25 10 月 2009 16:00 1 7467 25 10 月 2009 17:00 1 7468 25 10 月 2009 18:00 1 7469 25 10 月 2009 19:00 1 7470 25 10 月 2009 20:00 1 7471 25 10 月 2009 21:00 1 7472 25 10 月 2009 22:00 1 7473 25 10 月 2009 23:00 1 7474 26 10 月 2009 00:00 1 7475 26 10 月 2009 01:00 1 7476 26 10 月 2009 02:00 1 7477 26 10 月 2009 03:00 1 7478 26 10 月 2009 04:00 1 7479 26 10 月 2009 05:00 1 7480 26 10 月 2009 06:00 1 7481 26 10 月 2009 07:00 1 7482 26 10 月 2009 08:00 1 7483 26 10 月 2009 09:00 1 7484 26 10 月 2009 10:00 1 7485 26 10 月 2009 11:00 1 7486 26 10 月 2009 12:00 1 7487 26 10 月 2009 13:00 1 7488 26 10 月 2009 14:00 1 7489 26 10 月 2009 15:00 1 Specify the Second Pair of Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap2: 7483 Second Begin Snapshot Id specified: 7483 Enter value for end_snap2: 7486 Second End Snapshot Id specified: 7486最后,為要生成的報表命令: Specify the Report Name ~~~~~~~~~~~~~~~~~~~~~~~ The default report file name is awrdiff_1_7459_1_7483.html To use this name, press <return> to continue, otherwise enter an alternative. Enter value for report_name: awr_diff_1_7459_1_7483.html Using the report name awr_diff_1_7459_1_7483.html <HTML><HEAD><TITLE>Workload Repository Compare Period Report</TITLE> ............... ...............報表生成以后,在顯示時將以并列的形式,直觀的顯示出兩個不同時間段里,數(shù)據(jù)庫各項參數(shù)的差異,摘要如圖: 2.6 生成指定SQL語句的統(tǒng)計報表前例的對比是在單實例環(huán)境下進行的,如果希望對多實例的數(shù)據(jù)庫做對比,那就要使用$ORACLE_HOME/rdbms/admin/awrddrpi.sql腳本了。該腳本的操作基本與前例相同,這里不再演示,感興趣的朋友不妨自行測試。 |