The following articles mainly describe Common Errors of DB2 databases and the correct solutions. If you are curious about Common Errors of DB2 databases and the correct solutions, the following articles will unveil its mysteries. I hope you will gain some benefits after browsing.
Document category: Database
1. Error 42704 is reported when you create a DB2 database. For example:
SQL code
- =>create database test
- =>SQL0204N "SYSTEM_1386_US" is an undefined name. SQLSTATE=42704
- =>create database test
- =>SQL0204N "SYSTEM_1386_US" is an undefined name. SQLSTATE=42704
Solution: SQL code
- =>create database test using codeset gbk territory cn
- =>create database test using codeset gbk territory cn
2. A 57017 error is reported during data connection. For example:
SQL code
- =>connect to test user test using test
- =>SQL0332N Character conversion from the source code page "1386" to the target code page "819" is not supported. SQLSTATE=57017
- =>connect to test user test using test
- =>SQL0332N Character conversion from the source code page "1386" to the target code page "819" is not supported. SQLSTATE=57017
Solution:
SQL code
- =>db2set db2codepage=1386
- =>db2set db2codepage=1386
3. When operating the DB2 database, the system reports error 55039. For example:
SQL code
- =>db2 drop table t_base_acc_manageacc
- =>SQL0290N Table space access is not allowed. SQLSTATE=55039
- =>db2 list tablespaces show detail
- Tablespace ID = 2
- Name = USERSPACE1
- Type = System managed space
- Contents = Any data
- State = 0x0020
- Detailed explanation:
- Backup pending
- =>db2 drop table t_base_acc_manageacc
- =>SQL0290N Table space access is not allowed. SQLSTATE=55039
- =>db2 list tablespaces show detail
- Tablespace ID = 2
- Name = USERSPACE1
- Type = System managed space
- Contents = Any data
- State = 0x0020
- Detailed explanation:
Backup pending reason: the database has been loaded or modified to restart the database.
Solution:
SQL code
Back up a DB2 database
=> Db2 backup db
Back up database
=> Db2 backup db
4. When backing up the database, the system reports the 57019 error. For example:
SQL code
- =>db2 backup database dbname to /xx/xx compress
- =>SQL1035N The database is currently in use. SQLSTATE=57019
- =>db2 backup database dbname to /xx/xx compress
> SQL1035N The database is currently in use. SQLSTATE = 57019 solution:
SQL code
- =>db2stop force
- =>db2start
- =>db2stop force
- =>db2start
5. When creating a tablespace, the system reports the error 54047. For example:
SQL code
- =>create regular tablespace space1 pagesize 4 k managed by database using (device '/dev/dd' 25000000) prefetchsize automatic bufferpool bp1
- =>SQL1139N The total size of the table space is too big. SQLSTATE=54047
- =>create regular tablespace space1 pagesize 4 k managed by database using (device '/dev/dd' 25000000) prefetchsize automatic bufferpool bp1
=> SQL1139N The total size of the table space is too big. SQLSTATE = 54047 solution: reduce The tablespace size or change regular64G to large.
6. If the DB2 database fails to be backed up, it indicates that the memory is insufficient and dbheap is increased. SQL2009C. There is not enough memory to run this utility.
Cause: DB2 UTIL_HEAP_SZ is not set high enough for backup utilities.
Solution: db2 update db cfg for dbname using UTIL_HEAP_SZ the memory used for the specific digital db2 backup is UTIL_HEAP_SZ. Use the preceding command to adjust the memory ).
7. When you use JDBC to insert data into a table in batches. Error 23502 is reported. For example:
SQL code
- Error for batch element #0: DB2 SQL error: SQLCODE: -407, SQLSTATE: 23502, SQLERRMC: TBSPACEID=2, TABLEID=15, COLNO=2
Error for batch element #0: DB2 SQL error: SQLCODE:-407, SQLSTATE: 23502, SQLERRMC: TBSPACEID = 2, TABLEID = 15, COLNO = 2 cause: insert null values for fields with non-null constraints in the table.
Solution: View table definitions, remove non-null constraints, or add non-null values.
8. When you use JDBC to insert data into a table in batches. Error 22001 is reported. For example:
SQL code
- DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null
- DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null
Cause: if the length of a field in the table is insufficient, string truncation occurs.
Solution: view the table definition and increase the field length.
9. When you use JDBC to insert data into a table in batches. The error "-4474" is reported. For example:
SQL code
Invalid conversion: cannot be converted from "java. lang. String" to "byte []" ERRORCODE =-4474, SQLSTATE = null
Invalid conversion: cannot begin with "java. lang. string "to" byte [] "ERRORCODE =-4474, SQLSTATE = null reason: a field in the table is defined as 'id CHAR (16) for bit data not null', which is converted to uniqueidentifier when MTK is used to migrate DATA from ms SQL to DB2 database ).
Solution: recreate the table and change the field attribute to the VARCHAR type.