57016 or the Unavailable table

17. January 2007 06:57 by Mrojas in General  //  Tags: ,   //   Comments (0)
The idea was to create a harry potter like title jeje.
Today I had a new issue with DB2 (everyday you learn something new).
I got to work and we had some tables that you could not query or do anything. The system reported something like:
SQL0668N  Operation not allowed for reason code "1" on table "MYSCHEMA.MYTABLE".
SQLSTATE=57016
So I started looking what is an 57016 code????

After some googling I found that the table was in an "unavailable state". OK!!
But how did it got there? Well that I still I'm not certain. And the most important. How do I get it out of that state?????
Well I found that the magic spell is somehting like
>db2 set integrity for myschema.mytable immediate checked

After that statement everything works like a charm.
DB2 Docs state that:
"Consider the statement:

SET INTEGRITY FOR T IMMEDIATE CHECKED
Situations in which the system will require a full refresh, or will check the whole table
for integrity (the INCREMENTAL option cannot be specified) are:
  • When new constraints have been added to T itself
  • When a LOAD REPLACE operation against T, it parents, or its underlying tables has taken place
  • When the NOT LOGGED INITIALLY WITH EMPTY TABLE option has been activated after the last integrity check on T, its parents, or its underlying tables
  • The cascading effect of full processing, when any parent of T (or underlying table, if T is a materialized query table or a staging table) has been checked for integrity non-incrementally
  • If the table was in check pending state before migration, full processing is required the first time the table is checked for integrity after migration
  • If the table space containing the table or its parent (or underlying table of a materialized query table or a staging table) has been rolled forward to a point in time, and the table and its parent (or underlying table if the table is a materialized query table or a staging table) reside in different table spaces
  • When T is a materialized query table, and a LOAD REPLACE or LOAD INSERT operation directly into T has taken place after the last refresh"
But I really dont know what happened with my table.
Hope this help you out.