数据库版本:DB2/LINUX 9.7.5
症状:创建表报SQL0803N错
db2 "create table DB2INST1.T2(id int,name char(20))"
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0803N One or more values in the INSERT statement, UPDATE statement, or
foreign key update caused by a DELETE statement are not valid because the
primary key, unique constraint or unique index identified by "" constrains
table "" from having duplicate values for the index key. SQLSTATE=23505
db2diag日志:
2011-11-28-20.06.41.364011+480 I87866246G846 LEVEL: Info
PID : 4919 TID : 2942299040 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMPLE
APPHDL : 0-509 APPID: *LOCAL.db2inst1.111128115304
AUTHID : DB2INST1
EDUID : 18 EDUNAME: db2agent (SAMPLE) 0
FUNCTION: DB2 UDB, SW- common services, sqlnn_cmpl, probe:670
MESSAGE : ZRC=0x80090005=-2146893819=SQLI_DUPKEY "Duplicate key violation"
DIA8005C Duplicate key encountered, file token "" index token ""
record id "".
DATA #1 : String, 51 bytes
An error was detected during statement compilation.
DATA #2 : String, 163 bytes
Compiler error stack for rc = -2146893819:
sqlnn_cmpl[300]
sqlnp_main[250]
sqlnp_parser[510]
sqlnp_smactn[100]
sqlnq_table_defn1[210]
sqlnq_create_table_end[4700]
尝试检查:
(1)尝试select或drop都会报表未定义
db2 "select * from DB2INST1.T2"
SQL0204N "DB2INST1.T2" is an undefined name. SQLSTATE=42704
(2)使用db2 list tables for all|grep T2 可以查到对应表名
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
T2 DB2INST1 T 2011-11-25-17.00.42.742986
但是使用db2 list tables for schema db2inst1|grep T2 却查不到对应表名
(3)使用表名T2查询SYSCAT.TABLES都没查询到相关记录
请教,怎么解决这个问题?
附件:
db2diag1.log (10.84 KB)
filename.flw (632.75 KB)
收起