DB2 V8 引入的 Configuration Advisor (配置向導) 可自動依據工作負載特性推薦並套用資料庫管理器 (DBM)、資料庫 (DB) 及緩衝區參數。可透過圖形化控制中心或命令列 AUTOCONFIGURE 使用。
db2 autoconfigure [USING input-keyword value ...] APPLY {DB ONLY | DB AND DBM | NONE}
| 關鍵字 | 範圍 | 預設 | 說明 |
|---|---|---|---|
| mem_percent | 1-100 | 80 | DB2 可使用記憶體百分比,若主機有其他應用請調低 |
| workload_type | simple, mixed, complex | mixed | simple=OLTP(IO密集), complex=OLAP(CPU密集), mixed=混合 |
| num_stmts | 1-1,000,000 | 10 | 每筆交易平均 SQL 陳述式數 |
| tpm | 1-200,000 | 60 | 每分鐘交易量 (Transactions Per Minute) |
| admin_priority | performance, recovery, both | both | 偏好效能或恢復速度 |
| is_populated | yes, no | yes | 資料庫是否已有資料 |
| num_local_apps | 0-5,000 | 0 | 本地連線數 |
| num_remote_apps | 0-5,000 | 10 | 遠端連線數 |
| isolation | RR, RS, CS, UR | RR | 應用程式隔離層級 |
| bp_resizeable | yes, no | yes | 緩衝區是否可動態調整大小 |
環境:單一分區、實例 db2inst1、資料倉庫 TESTDW 已載入資料,屬複雜 OLAP 查詢。
db2_all "db2 connect to testdw; \
db2 autoconfigure using mem_percent 80 workload_type complex num_stmts 10 \
tpm 20 admin_priority both num_local_apps 5 num_remote_apps 50 isolation cs \
apply db and dbm; \
db2 connect reset"
/home/db2inst1/autoconfigure.db2 內含連線與 autoconfigure 指令。db2_all 並行執行並記錄日誌:db2_all "\""db2 -tvf /home/db2inst1/autoconfigure.db2 >> autoconfigure##.log"\""autoconfigure##.log 確認執行狀態。控制中心 → 右鍵資料庫 →「配置向導」,依精靈填答 (對應上表參數)。分區環境請將結果「另存為任務」並「導出腳本」,再以 db2_all 部署。
Configuration Advisor 能大幅減少 DBA 手動調校工作,但建議依實際負載微調產出的參數,並持續監控效能指標。