DB2 the reason of SQL error and the method of solving the problem

Source: Internet
Author: User
Tags db2 sql error

1. For the error in the execution, you can run the command under the DB2 command line: DB2=> sqlxxx See the corresponding error causes and solutions.

2. Error sql0206n sqlstate=42703 detected an undefined column, attribute, or parameter name.
sql0206n "Sql_cou_all" is not valid in the context where it is used. sqlstate=42703
DB2 =? "42703"
DB2 =? sql0206n

3. Error sql0668n Code "7" sqlstate=57016 table is in pending state, the table needs to be reorganized.
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: Description
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: Customer response
7 Reorganize The table using the REORG Table command.
For a table in the Reorg pending state, note that the following clauses is not allowed when reorganizing the table:
* The INPLACE REORG TABLE clause
* The on DATA PARTITION clause for a partitioned table when table have nonpartitioned indexes defined on the table

4. Error sql20054n code= "sqlstate=55019" the number of modifications to the table reached 3 times, must reorganize the table
ALTER TABLE xxx. Fm_borro ALTER COLUMN document_type_1 SET not NULL
Error: sql20054n the table "xxx. Fm_borrow "is in a invalid state for the operation.  Reason code= "23". sqlstate=55019
DB2 =? sql20054n
sql20054n the table "<table-name>" is in a 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 prevents the operation.
The maximum number of reorg-recommended alters has been
performed. Up to three reorg-recommended operations is allowed
On a table before a reorg must is performed, to update the
Tables rows to match the current schema.
User Response:
Reorg the table using the Reorg Table command.
Description: A table state exception can also be caused when changes are made to the table structure. For example, the following actions may cause the table to be in the reorg-pending state.
(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) ...
The origin of reorg pending is that when the table structure changes, the data format in the data row is affected, and the table needs to be reorg. The possible error numbers are:
01.sql0668n operation not allowed for reason code "7" on table "SDD.  St_incre008 ". sqlstate=57016
03.sql20054n the table "<table-name>" is in a invalid state for the operation. Reason code= "7".
Copy code Each table is allowed to make only 3 structural modifications without reorganizing (Reorg). The table must be reorganized after three changes.
REORG TABLE "xx". " Fm_borrow "Allow NO ACCESS keepdictionary;

5. Error sql0670n sqlstate=54010 The sum of all field lengths in this table is greater than the current database page size (8K)
ALTER TABLE xxx. FAQ ALTER COLUMN faq_unit_name SET DATA TYPE VARCHAR (800)
Error 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:
Specify a table space with a larger page size; clear one or more columns in a table

6. Error sql0190n sqlstate=42837 cannot change the column because its properties are incompatible with the current column property
ALTER TABLE xxx. bp_tmpdata_1_tb_1903 ALTER COLUMN rate SET DATA TYPE DECIMAL (6,4)
Error sql0190n ALTER TABLE "bp_tmpdata_1_tb_1903" Specified attributes for column ' rate ' that is not compatible with the EX  Isting column. sqlstate=42837
Description: bp_tmpdata_1_tb_1903 The accuracy of existing data exceeds DECIMAL (6,4), e.g. 100.00

7. Error SQL30081N sqlstate=08001 detected a communication error unable to establish connection with application server or other server
SQL30081N A Communication error has been detected.
Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS".
Location where the error is detected: "10.0.0.200". Communication function Detecting the error: "Selectforconnecttimeout".
Protocol specific error code (s): "0", "*", "*". sqlstate=08001
Check the configuration of the server as follows:
Verifying the existence of the DB2 database
DB2 List DB Directory
DB2 List DB Directory show detail
Verify the communication protocol used by the instance, and view the DB2COMM variable
Db2set-all
View the configuration of the Database manager, view Svcename (specifically the TCPIP protocol)
DB2 get dbm CFG
View/etc/services, there are no ports corresponding to the above svcename, for example:
DB2CDB2 50000/tcp
Verifying the remote server instance configuration
DB2 List Node Directory
DB2 List Node Directory show Detail
ping hostname to verify traffic
Use Telnet hostname port to verify that you can connect to the instance
Use the PCT tools provided by DB2 to detect

DB2 the reason of SQL error and the method of solving the problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.