SQL db2 中的更新表失败,SQLCODE:-668,SQLSTATE:57016,SQLERRMC:7;
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20396046/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failing update table in db2 with SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7;
提问by WCS Developer
I am using db2 9.5 i have created a column in table which is created successfully but i am not able to update table column and getting following error
我正在使用 db2 9.5 我在表中创建了一个列,该列已成功创建,但我无法更新表列并出现以下错误
[Error] Script lines: 1-1 -------------------------- DB2 SQL error: SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7;DB2ADMIN.XCATENTRYEXT Message: Operation not allowed for reason code "7" on table "DB2ADMIN.XCATENTRYEXT".
[错误] 脚本行:1-1 -------------------------- DB2 SQL 错误:SQLCODE:-668,SQLSTATE:57016,SQLERRMC: 7;DB2ADMIN.XCATENTRYEXT 消息:由于表“DB2ADMIN.XCATENTRYEXT”上的原因代码“7”,不允许操作。
Following the some blog/sites on google i found the REORG command as solution as mentioned in following link http://bytes.com/topic/db2/answers/508869-reorg-tablespace
在谷歌上的一些博客/站点之后,我发现 REORG 命令作为解决方案,如以下链接中提到的 http://bytes.com/topic/db2/answers/508869-reorg-tablespace
i have tried the following queries to run on database to solve the problem.
我已尝试在数据库上运行以下查询以解决问题。
Database["DB2"].ExecuteNonQuery("call SYSPROC.ADMIN_CMD ('REORG TABLE DB2ADMIN.XCATENTRYEXT index CATENTRY_ID INPLACE')")
REORG TABLE DB2ADMIN.XCATENTRYEXT index CATENTRY_ID INPLACE
REORG TABLE DB2ADMIN.XCATENTRYEXT
REORG INDEXES I0000908 FOR TABLE DB2ADMIN.XCATENTRYEXT
but all queries have the same error in result like
但所有查询在结果中都有相同的错误,例如
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: Database;BEGIN-OF-STATEMENT;<variable_set>
Message: An unexpected token "Database" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<variable_set>".
I am stuck on this error, I am not even able to update any column of that particular table.
我被这个错误困住了,我什至无法更新该特定表的任何列。
回答by Denis.Kipchakbaev
It is possible to do REORG through an SQL statement:
可以通过 SQL 语句进行 REORG:
CALL SYSPROC.ADMIN_CMD('REORG TABLE SCHEMA.TABLENAME');
回答by mustaccio
It follows from the error message, that you somehow submit the entire string Database["DB2"].ExecuteNonQuery("call SYSPROC.ADMIN_CMD ('REORG TABLE DB2ADMIN.XCATENTRYEXT index CATENTRY_ID INPLACE')")
as a SQL statement, which obviously is incorrect.
从错误消息可以看出,您以某种方式将整个字符串Database["DB2"].ExecuteNonQuery("call SYSPROC.ADMIN_CMD ('REORG TABLE DB2ADMIN.XCATENTRYEXT index CATENTRY_ID INPLACE')")
作为 SQL 语句提交,这显然是不正确的。
Simply issue these on the shell command line:
只需在 shell 命令行上发出这些命令:
db2 connect to <your database name here>
db2 REORG TABLE DB2ADMIN.XCATENTRYEXT