What it means
When you add a referential constraint, or a check constraint while CURRENT RULES is 'DB2', Db2 does not check the rows that are already there. Instead it marks the table space CHECK-pending.
The table space cannot be used normally until the pending state is cleared, so applications may start failing until someone runs the check.
Typical causes
- ALTER TABLE ... ADD FOREIGN KEY on a table that already has rows.
- ALTER TABLE ... ADD CHECK with CURRENT RULES = 'DB2'.
- A schema change applied without a follow-up utility step.
How to fix it
- Run the CHECK DATA utility on the table space named in the message.
- Fix or remove any rows that CHECK DATA reports as violating the constraint.
- Use DISPLAY DATABASE to confirm the CHECK-pending status has gone.
- Add the CHECK DATA step to your change procedure for future constraint changes.
Example
Illustrative only; names and values are invented.
ALTER TABLE MYSCHEMA.EMP ADD FOREIGN KEY (DEPTNO) REFERENCES MYSCHEMA.DEPT
SQLCODE = +162: TABLESPACE MYDB.MYTS HAS BEEN PLACED IN CHECK PENDING