1. 首页 > ITPUX技术网 > 正文

DB2数据库性能下降后做runstats及rebind包

在表(大表)的记录的条数有 30%的变化以后,就应该做一次 runstats
从方便管理的角度,直接从 syscat.tables中建script。

db2 “select ‘runstats on table db2inst1.’ || tabname || ‘ and indexes all’ from
syscat.tables where tabschema=’DB2INST1′ and type=’T’” >stats.sql

将 stats.sql中的多余的信息删除后,运行该脚本。
db2 -tvf stats.sql
请注意在做 runstats时,将其他应用全部断开。
为了提高速度,可以调整一下 database 的参数,将 applheapsz,
sortheadp,stmtheap先扩大10 倍,但注意做完 rebind 后将参数恢复回来。

注意:在作完 runstats 后,相关的 sp 如果不做 rebind,性能不会有任何变
化,不会使用新的统计数据来计算。

db2 “select ‘rebind package ‘||pkgname from syscat.packages where
pkgschema=’DB2INST1’ “ >rebind.sql

将 stats.sql中的多余的信息删除后,运行该脚本。
db2 -tvf rebind.sql

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息