$ db2 update db cfg for RESDB using LOGFILSIZ 25600 LOGPRIMARY 13 LOGSECOND 12 CATALOGCACHE_SZ 2048 LOGBUFSZ 4096 UTIL_HEAP_SZ 10240 DB_MEM_THRESH 100 DLCHKTIME 5000 LOCKTIMEOUT 15
9.3其他参数调整
db2set DB2_PARALLEL_IO=*
db2set DB2_SKIPINSERTED=YES
db2set DB2_USE_ALTERNATE_PAGE_CLEANING=YES
db2set DB2_EVALUNCOMMITTED=YES
db2set DB2_ANTIJOIN=EXTEND
db2set DB2_SKIPDELETED=YES
db2set DB2CODEPAGE=1208
参数调整完毕,数据库重启:
$ db2stop
01/23/2017 13:48:24 0 0 SQL1025N The database manager was not stopped because databases are still active.
SQL1025N The database manager was not stopped because databases are still active.
$ db2 force application all
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
$ db2stop
01/23/2017 13:49:39 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.
$ db2start
01/23/2017 13:50:13 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
此时需要调整/etc/security/limits.conf配置文件
db2list1 soft nofile 65536
db2inst1 hard nofile 65536
db2inst1 soft nproc 65536
db2inst1 hard nproc 65536
重新连接数据库:
$ db2 connect to resdb
SQL1116N A connection to or activation of database "RESDB" failed because the
database is in BACKUP PENDING state. SQLSTATE=57019
批注:若修改数据里LOGRETAIN参数,从循环日志模式改为归档模式,则会导致数据库BACKUP PENDING,如下处理
$ db2 update db cfg for resdb using LOGRETAIN RECOVERY
SQL1597N Configuring the DB2 environment failed because the specified DB2
configuration parameter is discontinued.
此时无法连接,需要对数据库做离线全备,使状态恢复正常,以便能够访问。
$ db2 backup db resdb to /dev/null
Backup successful. The timestamp for this backup image is : 20170123135258
$ db2 connect to resdb
10.打开Oracle兼容模式
$ db2set DB2_COMPATIBILITY_VECTOR=ORA
$ db2set -all |grep 'DB2_COMPATIBILITY_VECTOR'
重启数据库
$ db2stop force
$ db2start
11.创建数据库对象
$ db2 "create bufferpool BP_DAT_32K size 16000 pagesize 32k"
$ db2 "create bufferpool BP_IDX_32K size 16000 pagesize 32k"
$ db2 "create bufferpool BP_TMP_32K size 16000 pagesize 32k"