DB2 sql报错后查证原因与解决问题的方法
1.对于执行中的报错,可以在db2命令行下运行命令 : db2=>? SQLxxx 查看对应的报错原因及解决方法。
2.错误SQL0206N SQLSTATE=42703 检测到一个未定义的列、属性或参数名。
SQL0206N "SQL_COU_ALL" is not valid in the context where it is used. SQLSTATE=42703
db2 => ? "42703"
db2 => ? SQL0206N
3.错误SQL0668N code "7" SQLSTATE=57016 表处于pending state,需要重组该表。
SQL0668N Operation not allowed for reason code "7" on table "xxx.Z_BP_TMPBATCH_TB_HIS". SQLSTATE=57016
db2 => ? SQL0668N code 7
SQL0668N Operation not allowed for reason code "<reason-code>" on table "<table-name>".
Explanation:说明
Access to table "<table-name>" is restricted. The cause is based on the following reason codes "<reason-code>":
7 The table is in the reorg pending state. This can occur after an ALTER TABLE statement containing a REORG-recommended operation.
User response:用户响应
7 Reorganize the table using the REORG TABLE command.
For a table in the reorg pending state, note that the following clauses are not allowed when reorganizing the table:
* The INPLACE REORG TABLE clause
* The ON DATA PARTITION clause for a partitioned table when table has nonpartitioned indexes defined on the table
4.错误SQL20054N code="23" SQLSTATE=55019 对表的修改次数达到3次,必须重组表
ALTER TABLE xxx.FM_BORRO ALTER COLUMN DOCUMENT_TYPE_1 SET NOT NULL
报错:SQL20054N The table "xxx.FM_BORROW" is in an invalid state for the operation. Reason code="23". SQLSTATE=55019
db2 => ? SQL20054N
SQL20054N The table "<table-name>" is in an invalid state for the operation. Reason code="<reason-code>".
Explanation:
The table is in a state that does not allow the operation. The "<reason-code>" indicates the state of the table that prevents the operation.
23 The maximum number of REORG-recommended alters have been
performed. Up to three REORG-recommended operations are allowed
on a table before a reorg must be performed, to update the
tables rows to match the current schema.
User response:
23 Reorg the table using the reorg table command.
说明:当对表结构进行更改时,也可能导致表状态异常。比如,以下操作可能会导致表处于reorg-pending状态。
(1) alter table <tablename> alter <colname> set data type <new data type>
(2) alter table <tablename> alter <colname> set not null
(3) alter table <tablename> drop column <colname>
(4) ……
出现reorg pending的根源是当表结构变化后影响了数据行中的数据格式,这时需要对表做reorg。可能的错误号是:
01.SQL0668N Operation not allowed for reason code "7" on table "SDD.ST_INCRE008". SQLSTATE=57016
03.SQL20054N The table "<table-name>" is in an invalid state for the operation. Reason code="7".
复制代码每一个表在不进行重组(Reorg)的前提下,只允许进行3次结构上的修改。三次更改后必须对表进行重组。
REORG TABLE "xx"."FM_BORROW" ALLOW NO ACCESS KEEPDICTIONARY;
5.报错 SQL0670N SQLSTATE=54010 该表所有字段长度之和大于当前数据库页大小(8K)
ALTER TABLE xxx.FAQ ALTER COLUMN FAQ_UNIT_NAME SET DATA TYPE VARCHAR(800)
报错 SQL0670N The row length of the table exceeded a limit of "8101" bytes. (Table space "SHJD_DATA".) SQLSTATE=54010
db2 => ? SQL0670N
SQL0670N The row length of the table exceeded a limit of "<length>" bytes. (Table space "<tablespace-name>".)
Explanation:
The row length of a table in the database manager cannot exceed:
* 4005 bytes in a table space with a 4K page size
* 8101 bytes in a table space with an 8K page size
* 16293 bytes in a table space with an 16K page size
* 32677 bytes in a table space with an 32K page size
The length is calculated by adding the internal lengths of the columns.Details of internal column lengths can be found under CREATE TABLE in the SQL Reference.
User response:
指定页大小更大的表空间;消除表中的一列或多列
6.报错 SQL0190N SQLSTATE=42837 不能改变该列,因为它的属性与当前的列属性不兼容
ALTER TABLE xxx.BP_TMPDATA_1_TB_1903 ALTER COLUMN RATE SET DATA TYPE DECIMAL(6,4)
报错 SQL0190N ALTER TABLE "BP_TMPDATA_1_TB_1903" specified attributes for column "RATE" that are not compatible with the existing column. SQLSTATE=42837
说明: BP_TMPDATA_1_TB_1903 现有数据的精度超过了 DECIMAL(6,4) ,比如100.00
7.报错 SQL30081N SQLSTATE=08001 检测到通信错误 无法与应用程序服务器或其他服务器建立连接
SQL30081N A communication error has been detected.
Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS".
Location where the error was detected: "10.0.0.200". Communication function detecting the error: "selectForConnectTimeout".
Protocol specific error code(s): "0", "*", "*". SQLSTATE=08001
检查服务器的配置情况如下:
验证存在的DB2数据库
db2 list db directory
db2 list db directory show detail
验证实例使用的通讯协议,查看DB2COMM变量
db2set -all
查看数据库管理器的配置,查看SVCENAME(特指tcpip协议)
db2 get dbm cfg
查看/etc/services中,有无与上面对应SVCENAME的端口,例如:
db2cDB2 50000/tcp
验证远程服务器实例配置
db2 list node directory
db2 list node directory show detail
ping hostname来验证通讯
使用telnet hostname port来验证是否能连到实例
用DB2提供的PCT工具来检测一下
DB2 sql报错后查证原因与解决问题的方法的更多相关文章
- Ansible 脚本运行一次后,再次运行时出现报错情况,原因:ansible script 的格式不对,应改成Unix编码
Ansible 脚本运行一次后,再次运行时出现报错情况,原因:ansible script 的格式不对,应改成Unix编码 find . -name "*" | xargs do ...
- 转 sqlplus执行sql报错:ORA-01756:
1.sqlplus执行sql报错:ORA-01756: quoted string not properly terminated 分类: 技术 在SQLPLUS中执行SQL文件时 ...
- 数据库执行sql报错Got a packet bigger than 'max_allowed_packet' bytes及重启mysql
准备在mysql上使用数据库A,但mysql5经过重装后,上面的数据库已丢失,只得通过之前备份的A.sql重新生成数据库A. 1.执行sql报错 在执行A.sql的过程中,出现如下错误:Got a p ...
- 利用sql报错帮助进行sql注入
我们可以利用sql报错帮助进行sql注入,这里以sql server 为例: sql查询时,若用group by子句时,该子句中的字段必须跟select 条件中的字段(非聚合函数)完全匹配,如果是se ...
- Python 装饰器填坑指南 | 最常见的报错信息、原因和解决方案
本文为霍格沃兹测试学院学员学习笔记. Python 装饰器简介 装饰器(Decorator)是 Python 非常实用的一个语法糖功能.装饰器本质是一种返回值也是函数的函数,可以称之为“函数的函数”. ...
- 转:Loadrunner报错“Too many local variablesAction.c”解决方法
问题描述,在Action.c里定义数组时如果数组长度过长,如char a[1024*1024]运行时即会报错: 问题原因及解决方法如下: 1. VuGen对于局部变量可以分配的最大内存为64K,如果想 ...
- linux下svn客户端报错Cannot negotiate authentication mechanism的解决方法
svn客户端报错Cannot negotiate authentication mechanism的解决方法: 问题出现的原因之一: 因为SVN服务器配置了saslauthd服务用来实现与ldap的对 ...
- 安装PHP过程中,make步骤报错:(集合网络上各种解决方法)
安装PHP过程中,make步骤报错:(集合网络上各种解决方法) (1)-liconv -o sapi/fpm/php-fpm /usr/bin/ld: cannot find -liconv coll ...
- 关于163发邮件报错535 Error:authentication failed解决方法
关于发邮件报错535 Error:authentication failed解决方法 调用163邮箱服务器来发送邮件,我们需要开启POP3/SMTP服务,这时163邮件会让我们设置客户端授权码,这个授 ...
随机推荐
- msf客户端渗透(四):关闭UAC,hash、防火墙、服务、磁盘、DEP、防病毒、远程桌面、桌面截图、获取tooken
关闭UAC 如果你获得一个system权限的session 进入到这个session 进入到shell 依次输入以下命令 cmd.exe /k %windir%\System32\reg.exe AD ...
- burpsuite的使用(二)
爬网 为了爬网更加顺畅,先关掉截断功能 先进行手动爬网 然后进到目标页面需要点的地方和输入的地方去操作一下,在spider下就能看到爬网的记录 自动爬网 当你爬网时需要登录身份验证时,提示输入,也可以 ...
- 解题10(LongestSubStrBetweenAB)
题目描述 查找两个字符串a,b中的最长公共子串.若有多个,输出在较短串中最先出现的那个. 输入描述: 输入两个字符串 输出描述: 返回重复出现的字符 示例1 输入 abcdefghijklmnop a ...
- 贪吃蛇snake Java实现(二)
package cn.tcc.snake.antition; import java.awt.Color;import java.awt.Graphics;import java.awt.Point; ...
- fragment 与activity通信 Bundle 序列化数据 Serializable
1.fragment简单套用(静态调用): 新建一个fragment,其xml文件如下: <LinearLayout xmlns:android="http://schemas.and ...
- ubuntu下手动安装php-amqp模块教程
用于ubuntu的默认源里面没有php5-amqp这个包,所以要用上amqp得考手动编译. 参考手册 http://php.net/manual/pl/book.amqp.php 首先安装必须的php ...
- vue 父子组件相互传参
转自https://blog.csdn.net/u011175079/article/details/79161029 子组件: <template> <div> <di ...
- 【Android内存泄漏检测】LeakCanary使用总结
一.什么是LeakCanary? LeakCanary就是用来检测Android端内存泄漏的一个工具.能够检测Activity的泄漏 什么是内存泄漏? Java 对象有时也会”长死不死“,GC 拿它没 ...
- TZOJ 3663 最长路径(floyd)
描述 网络是由很多交换机与网线组成的,网络中的信息可能会在这些网络中不断转发,给定任意两个交换机,我们需要从中找到最快的路径进行转发,我们定义转发过程中所经过的网线条数为两个交换机之间的路径长度.如果 ...
- wk1&2 字符串
[CQ] 自增怎么样都增了,赋值不一定: int x = 2; int y = 2; int i = ++x; int j = y++; System.out.println(x); System.o ...