1. 程式人生 > >DB2中遇到的錯誤及修改方法

DB2中遇到的錯誤及修改方法

錯誤1
com.ibm.db2.jcc.b.nm: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2ADMIN.SOFT_VERSION, DRIVER=3.50.152

原因是:表SOFT_VERSION不是直接在DB2ADMIN下面,應在DB2命令編輯器檢視SOFT_VERSION在那個目錄下面。


錯誤2
com.ibm.db2.jcc.c.DisconnectException: encoding not supported!!
at com.ibm.db2.jcc.a.bb.b(bb.java:1610)
at com.ibm.db2.jcc.a.cb.ac(cb.java:4454)
at com.ibm.db2.jcc.a.cb.a(cb.java:4392)
at com.ibm.db2.jcc.a.cb.c(cb.java:4314)
at com.ibm.db2.jcc.a.cb.b(cb.java:4247)
at com.ibm.db2.jcc.a.cb.a(cb.java:4225)
at com.ibm.db2.jcc.a.cb.l(cb.java:373)
at com.ibm.db2.jcc.a.cb.d(cb.java:145)
at com.ibm.db2.jcc.a.b.Sb(b.java:1274)
at com.ibm.db2.jcc.a.b.a(b.java:1166)
at com.ibm.db2.jcc.a.b.q(b.java:934)
at com.ibm.db2.jcc.a.b.a(b.java:702)
at com.ibm.db2.jcc.a.b.<init>(b.java:305)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:162)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.huawei.client.db.DBConnection.init(DBConnection.java:52)
at com.huawei.client.db.DBConnection.main(DBConnection.java:81)

原因是:架包出了問題,把本地的架包放進去就OK了。


錯誤3
匯入表時,報以下異常,表結構已建立,但是資料沒有導進表中。
[email protected]
:~/wsx> db2 "import from TBL_OPTION.ixf of ixf create into test1"
SQL3150N The H record in the PC/IXF file has product "DB2 02.00", date
"20100826", and time "181146".

SQL3153N The T record in the PC/IXF file has name "TBL_OPTION.ixf", qualifier
"", and source " ".

SQL3109N The utility is beginning to load data from file "TBL_OPTION.ixf".

SQL3550W The field value in row "1" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "2" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "3" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "4" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "5" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "6" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "7" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "8" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "9" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "10" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "11" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "12" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "13" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3550W The field value in row "14" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

SQL3110N The utility has completed processing. "14" rows were read from the
input file.

SQL3221W ...Begin COMMIT WORK. Input Record Count = "14".

SQL3222W ...COMMIT of any database changes was successful.

SQL3149N "14" rows were processed from the input file. "0" rows were
successfully inserted into the table. "14" rows were rejected.


Number of rows read = 14
Number of rows skipped = 0
Number of rows inserted = 0
Number of rows updated = 0
Number of rows rejected = 14
Number of rows committed = 14

原因是由於表中的ID為自增序列,在匯入表時,增加一個引數即可。如下:
load from 檔名.ixf of ixf modified by identityoverride insert into 表名
load from 檔名.ixf of ixf modified by identityignore insert into 表名


錯誤4
查詢表是報如下錯誤:
SQL0668N Operation not allowed for reason code "3" on table
"DB2INST1.TBL_PIM_NODE_SRC_USER_STATE". SQLSTATE=57016

原因是LOAD的時候表暫掛了(loading pending),執行如下命令可解:
db2 "load from .*.ixf of ixf terminate into 表名“


錯誤5
往表裡匯入日誌時報,如下錯誤:
SQL3306N An SQL error "-964" occurred while inserting a row into the table.

SQL0964C The transaction log for the database is full. SQLSTATE=57011

SQL3110N The utility has completed processing. "17503423" rows were read
from the input file.

原因:事務日誌已滿。


錯誤6
DB2 SQL error: SQLCODE: -911, SQLSTATE: 40001
原因:死鎖或者超時了,自動回滾了
解決方法:
db2 "force applications all"
db2 terminate(此條命令可多執行幾次)