db2 get db cfg for <dbname> | grep -i log
重點參數:LOGFILSIZ(單檔大小,4KB 頁)、LOGPRIMARY(主要檔數)、LOGSECOND(次要檔數)。
需以具 SYSADM 或 SYSCTRL 權限的使用者(通常是實例擁有者 db2inst1 或 db2admin)連線:
db2 connect to <dbname> user db2inst1 using password
一般應用程式帳號無修改權限。
db2 update db cfg for <dbname> using LOGFILSIZ 4096
db2 update db cfg for <dbname> using LOGPRIMARY 20
db2 update db cfg for <dbname> using LOGSECOND 10
以上範例將單檔調為 16MB(4096×4KB),主要 20 檔、次要 10 檔,總計約 480MB 日誌空間。
db2 force application all 中斷所有連線db2stop / db2start 重啟實例db2 get db cfg 確認參數已更新若使用循環日誌,大量匯入時可搭配 COMMITCOUNT 參數定期提交,避免單一交易撐爆日誌:
db2 import from data.ixf of ixf commitcount 1000 insert into target_table