DB2 常见问题排查
- DB2 常见问题排查
- 备份或者还原未完成
- 问题
- 排查
- 解决
- 还原完后不能连接到数据库
- 问题
- 排查
- 解决
- 空间不足不能执行命令
- 问题
- 排查
- 解决
- 事务日志已经满
- 问题
- 排查
- 解决
- 连接数据库,分配共享内容失败,内核限制
- 问题
- 创建字段 varchar 设置过大
- 问题
- 参考引用
- 备份或者还原未完成
DB2 常见问题排查
备份或者还原未完成
问题
执行操作,提示如下:
[db2inst@localhost ~]$ db2 deactivate db necc_dbSQL1120N A connection to or activation of database "NECC_DB" cannot be madebecause a previous backup or restore is incomplete. SQLSTATE=57019
排查
根据 https://www.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.messages.sql.doc/doc/msql01120n.html描述:“因为先前备份或复原不完整,所以不能连接或激活数据库 名称。”
解决
直接删除了数据,再执行还原该数据库
[db2inst@localhost ~]$ db2 drop db necc_dbDB20000I The DROP DATABASE command completed successfully.
还原完后不能连接到数据库
问题
从备份中恢复DB2数据库(本例是指“NECC_DB”)的拷贝到新的DB2服务器(本例是指“NECC_DBA”)。用户已创建一个新的数据库连接(指向这个新的数据库副本),当试图连接这个新的数据库时,提示如下错误:
[db2inst@localhost ~]$ db2 connect to necc_dbSQL1117N A connection to or activation of database "NECC_DB" cannot be madebecause of ROLL-FORWARD PENDING. SQLSTATE=57019
排查
出现SQL1117N 由于 ROLL-FORWARD PENDING,不能连接或激活数据库 “NECC_DBA”。
解决
将数据库前滚。
执行:
db2 rollforward db <database> complete
如:
[db2inst@localhost ~]$ db2 rollforward db necc_dba completeRollforward StatusInput database alias = necc_dbaNumber of members have returned status = 1Member ID = 0Rollforward status = not pendingNext log file to be read =Log files processed = -Last committed transaction = 2016-04-27-09.18.11.000000 UTCDB20000I The ROLLFORWARD command completed successfully.[db2inst@localhost ~]$
空间不足不能执行命令
问题
执行 db2 语句创建或者删除数据库操作,均出现如下提示
SQL1004C There is not enough storage on the file system to process the command.
排查
用户的磁盘不够了。增加用户磁盘,或者删除一些数据,来增大用户能使用的空间。
解决
删除了没有用的数据库和老旧的数据库备份文件。
事务日志已经满
问题
执行 db2 语句创建数据库索引、或者执行修改操作,均出现如下提示
DB2 Database Error: ERROR [57011] [IBM][DB2/LINUXX8664] SQL0964C The transaction log for the database is full.
排查
事务日志已满。
通过 db2 => get db cfg 语句来查看日志文件的配置:
Log file size (4KB) (LOGFILSIZ) = 1024Number of primary log files (LOGPRIMARY) = 13Number of secondary log files (LOGSECOND) = 12
解决
把日志文件的大小和日志文件的数量扩充。
db2 => update db cfg using LOGFILSIZ 10240DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.SQL1363W Database must be deactivated and reactivated before the changes toone or more of the configuration parameters will be effective.db2 => update db cfg using LOGPRIMARY 100DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.SQL1363W Database must be deactivated and reactivated before the changes toone or more of the configuration parameters will be effective.db2 => update db cfg using LOGSECOND 100DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.db2 =>
连接数据库,分配共享内容失败,内核限制
问题
连接到数据库时,出现如下提示
ERROR [57019] [IBM] SQL1084C The database manager failed to allocate shared memory because an operating system kernel memory limit has been reached. SQLSTATE=57019
创建字段 varchar 设置过大
问题
创建字段时,varchar 设置为 500 ,报错
SQL 错误 [42727]: A table space could not be found with a page size of at least "8192" that authorization ID "DB2INST" is authorized to use.. SQLCODE=-286, SQLSTATE=42727, DRIVER=4.16.53com.ibm.db2.jcc.am.SqlSyntaxErrorException: A table space could not be found with a page size of at least "8192" that authorization ID "DB2INST" is authorized to use.. SQLCODE=-286, SQLSTATE=42727, DRIVER=4.16.53
- http://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.dbobj.doc/doc/c0061057.html
- http://www.db2china.net/Question/39301
- http://www.west.cn/www/info/28275-1.htm
db2 => connect to necc_dbDatabase Connection InformationDatabase server = DB2/LINUXX8664 10.1.0SQL authorization ID = DB2INSTLocal database alias = NECC_DBdb2 => LIST TABLESPACES SHOW DETAILTablespaces for Current DatabaseTablespace ID = 0Name = SYSCATSPACEType = Database managed spaceContents = All permanent data. Regular table space.State = 0x0000Detailed explanation:NormalTotal pages = 32768Useable pages = 32764Used pages = 32244Free pages = 520High water mark (pages) = 32244Page size (bytes) = 4096Extent size (pages) = 4Prefetch size (pages) = 4Number of containers = 1Tablespace ID = 1Name = TEMPSPACE1Type = System managed spaceContents = System Temporary dataState = 0x0000Detailed explanation:NormalTotal pages = 1Useable pages = 1Used pages = 1Free pages = Not applicableHigh water mark (pages) = Not applicablePage size (bytes) = 4096Extent size (pages) = 32Prefetch size (pages) = 32Number of containers = 1Tablespace ID = 2Name = USERSPACE1Type = Database managed spaceContents = All permanent data. Large table space.State = 0x0000Detailed explanation:NormalTotal pages = 16384Useable pages = 16352Used pages = 14048Free pages = 2304High water mark (pages) = 14048Page size (bytes) = 4096Extent size (pages) = 32Prefetch size (pages) = 32Number of containers = 1Tablespace ID = 3Name = SYSTOOLSPACEType = Database managed spaceContents = All permanent data. Large table space.State = 0x0000Detailed explanation:NormalTotal pages = 8192Useable pages = 8188Used pages = 192Free pages = 7996High water mark (pages) = 192Page size (bytes) = 4096Extent size (pages) = 4Prefetch size (pages) = 4Number of containers = 1db2 =>
ALTER TABLESPACE tablespacename CONVERT TO LARGE
参考引用
- http://www-01.ibm.com/support/docview.wss?uid=swg21962486
- http://www.cnblogs.com/frankliiu-java/articles/2186343.html

免费 AI IDE


更多建议: