从今天开始DB2相关的内容
系统为 Redhat 7.4
数据库为 v10.5fp10
上节我们说了如何建立数据库,这节内容为设置常见的参数
DB2中一个实例下可以有多个数据库,一个数据库只能属于一个实例
所有命令在db2inst1用户下运行
如下命令设置备份中的历史信息保存天数,
db2 "update db cfg for testdb using REC_HIS_RETENTN 90"
单位为数据库页大小,一般为4K
db2 "update db cfg for testdb using catalogcache_sz 500"
db2 "update db cfg for testdb using logfilsiz 10240"
db2 "update db cfg for testdb using logprimary 80"
db2 "update db cfg for testdb using logsecond 50"
primary+second 不能超过255
用于避免死锁发生,单位为秒
db2 "update db cfg for testdb using LOCKTIMEOUT 300"
db2 "update db cfg for testdb using SELF_TUNING_MEM on"
对于索引的建立,重建,重整是否记录日志,在HADR中需要设置,类似于Oracle的DataGuard
db2 "update db cfg for testdb using LOGINDEXBUILD on"
该参数决定表的是否可以设置NOT LOGGED 和NOT LOGGED INITIALLY属性
db2 "update db cfg for testdb using BLOCKNONLOGGED on"
db2 update db cfg for testdb using logarchmeth1 DISK:/db2data/db2_archive
db2 force application all
db2 connect to testdb
db2 backup db testdb to /db2data/backup
最后重启下实例和数据库
db2 force application all
db2 terminate
db2stop
db2start
db2 "activate db testdb"
db2 connect to testdb