Db2

Β View Only

 Db2 EAP 94 still throws SQL2219N,RC 20

Peter Schurr's profile image
Peter Schurr posted Mon July 28, 2025 09:36 AM

Hi,
I downloaded and installed Db2 EAP 94 / DB2 v12.1.3.0 on SLES (SLES 15 SP6).

I tried to run inplace table reorganization on partitioned tables with nonpartitioned indexes, but it still fails with SQL2219N, RC 20.

Table DDL:
SET CURRENT SCHEMA db2admin ;
CREATE TABLE beleg_rpt (
  id BIGINT NOT NULL  GENERATED BY DEFAULT AS IDENTITY (START WITH 1 CACHE 10 ) ,
  mandantid INT NOT NULL,
  cat CHAR(1)  NOT NULL ,
  ts DATE  NOT NULL DEFAULT CURRENT DATE
        )
  INDEX IN tbsi1
        PARTITION BY RANGE(cat )
  (
  PARTITION b1 STARTING 'A'  ENDING 'A' IN tbsp1 INDEX IN tbsi1 ,
  PARTITION b2 STARTING 'B'  ENDING 'B' IN tbsp2 INDEX IN tbsi2 ,
  PARTITION b3 STARTING 'C'  ENDING 'C' IN tbsp3 INDEX IN tbsi3
  )
  COMPRESS YES ADAPTIVE ;
CREATE UNIQUE INDEX beleg_rpt_un ON beleg_rpt(id  ) NOT PARTITIONED ;
ALTER TABLE db2admin.beleg_rpt ADD CONSTRAINT beleg_rpt_pk PRIMARY KEY ( id ) ;
CREATE INDEX beleg_rpt_ix01 ON beleg_rpt(mandantid) NOT PARTITIONED ;
CREATE INDEX beleg_rpt_ix03 ON beleg_rpt(cat) NOT PARTITIONED ;
CREATE INDEX beleg_rpt_ix02 ON beleg_rpt(cat, mandantid) NOT PARTITIONED ;

Command I am trying, and the error code:
db2 "REORG TABLE DB2ADMIN.BELEG_RPT INPLACE INDEX beleg_rpt_ix03  ON DATA PARTITION b1 "
SQL2219N  The inplace table reorganization failed on one or more members.
Table name: "BELEG_RPT". Reason code: "20".

Am I missing any in the DDL or in the REORG command?

Regards, Peter

Jan Nelken's profile image
Jan Nelken IBM Champion

Hi Peter!

I am sure this does not help you, but I confirm I have the same symptom on Ubuntu distro with the following db2level:

db2inst1@Tablecik:~$ db2level
DB21085I  This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL12013" with level identifier "02040110".
Informational tokens are "DB2 v12.1.3.0", "s2507132358", "DYN2507132358AMD64",and Fix Pack "0".
Product is installed at "/opt/ibm/db2/V12.1".

SQL2219N RC=20 means:

20

         A reorganization on a range partitioned table failed because a
         nonpartitioned index exists on the table.

Suggested remedy is :-) :

20

         Either drop the nonpartitioned indexes and reissue the
         reorganization command, or remove the INPLACE option from the
         reorganization command.


I am only guessing, that INPLACE reorg on global (nonpartitioned) index didn't made to this build level yet.




Peter Schurr's profile image
Peter Schurr

Thanks Jan,
I was just wondering if I am missing anything. Because this enhancement was announced as new feature:
https://early-access.ibm.com/software/support/trial/cst/programwebsite.wss?siteId=824&h=&tabId=.
Perhaps it was a wrong build being provided.

Regards, Peter

Jan Nelken's profile image
Jan Nelken IBM Champion

Peter, whatever it is worth, the current build on BGV (Bill Gates Virus) appears to be working:

C:\Temp>db2 connect to sample

   Database Connection Information

 Database server        = DB2/NT64 12.1.3.0
 SQL authorization ID   = DB2ADMIN
 Local database alias   = SAMPLE


C:\Temp>db2 create tablespace tbsp1 managed by automatic storage
DB20000I  The SQL command completed successfully.

C:\Temp>db2 create tablespace tbsp2 managed by automatic storage
DB20000I  The SQL command completed successfully.

C:\Temp>db2 create tablespace tbsp3 managed by automatic storage
DB20000I  The SQL command completed successfully.

C:\Temp>db2 create tablespace tbsi1 managed by automatic storage
DB20000I  The SQL command completed successfully.

C:\Temp>db2 create tablespace tbsi2 managed by automatic storage
DB20000I  The SQL command completed successfully.

C:\Temp>db2 create tablespace tbsi3 managed by automatic storage
DB20000I  The SQL command completed successfully.

C:\Temp>db2 -tvf junk.db2
SET CURRENT SCHEMA db2admin
DB20000I  The SQL command completed successfully.

CREATE TABLE beleg_rpt ( id BIGINT NOT NULL  GENERATED BY DEFAULT AS IDENTITY (START WITH 1 CACHE 10 ) , mandantid INT NOT NULL, cat CHAR(1)  NOT NULL , ts DATE  NOT NULL DEFAULT CURRENT DATE ) INDEX IN tbsi1 PARTITION BY RANGE(cat ) ( PARTITION b1 STARTING 'A'  ENDING 'A' IN tbsp1 INDEX IN tbsi1 , PARTITION b2 STARTING 'B'  ENDING 'B' IN tbsp2 INDEX IN tbsi2 , PARTITION b3 STARTING 'C'  ENDING 'C' IN tbsp3 INDEX IN tbsi3 ) COMPRESS YES ADAPTIVE
DB20000I  The SQL command completed successfully.

CREATE UNIQUE INDEX beleg_rpt_un ON beleg_rpt(id  ) NOT PARTITIONED
DB20000I  The SQL command completed successfully.

ALTER TABLE db2admin.beleg_rpt ADD CONSTRAINT beleg_rpt_pk PRIMARY KEY ( id )
SQL0598W  Existing index "DB2ADMIN.BELEG_RPT_UN" is used as the index for the
primary key or a unique key.  SQLSTATE=01550

CREATE INDEX beleg_rpt_ix01 ON beleg_rpt(mandantid) NOT PARTITIONED
DB20000I  The SQL command completed successfully.

CREATE INDEX beleg_rpt_ix03 ON beleg_rpt(cat) NOT PARTITIONED
DB20000I  The SQL command completed successfully.

CREATE INDEX beleg_rpt_ix02 ON beleg_rpt(cat, mandantid) NOT PARTITIONED
DB20000I  The SQL command completed successfully.


C:\Temp>db2 "REORG TABLE DB2ADMIN.BELEG_RPT INPLACE INDEX beleg_rpt_ix03  ON DATA PARTITION b1 "
DB20000I  The REORG command completed successfully.
DB21024I  This command is asynchronous and may not be effective immediately.


Db2 level is:

C:\Temp>db2level
DB21085I  This instance or install (instance name, where applicable: "DB2")
uses "64" bits and DB2 code release "SQL12013" with level identifier
"02040110".
Informational tokens are "DB2 v12.1.3000.251", "s2507231221",
"DYN2507231221WIN64", and Fix Pack "0".
Product is installed at "C:\V12.1.3\SQLLIB" with DB2 Copy Name "DB2V12R1M3F0".

Peter Schurr's profile image
Peter Schurr

Hi Jan,
Thanks for the info.
Nice description (BGV) for WIndows ;-)
I do not test on Windows ( security issues are always annoying).
BR  Peter

Wei Cao's profile image
Wei Cao

Hi Peter and Jan,

Thanks for trying out the EAP on different platforms!

Peter, you're not missing anything - the Windows EAP build is slightly newer than the Linux one, so it includes a few additional changes (some of that "magic" Jan noted 😊).

If you'd like to explore the feature on Linux, you have two options:

  • Email me directly, and I’ll send you the instructions, or
  • Wait for the next EAP drop, currently targeted for the end of August (subject to change)

Thanks again for your interest and feedback!

Best regards,
Wei

Peter Schurr's profile image
Peter Schurr

Hi Wei,
thanks a lot for the clarification.
I will wait for the next EAP drop.
BR Peter