SQL0668N Operation not allowed for reason code 3 (or) DB2 table in Load pending state

Issue/Error:

SQL0668N Operation not allowed for reason code "3" on table "schema.tablename"
(or)
Table is in Load pending state.


When will table go into Load pending state:

If a DB2 Load command/job under execution on table encounters a problem and doesn't complete successfully, then that table will be put into a Load pending state.


Checking for the status of table:

db2 -v "load query table schema.tablename"


If the database is partitioned, above command might not give the required status of the table for all other partitions. Hence, I believe below command is the best fit to get the status of tables which are impacted by Load. (select command will take sometime to return the records. Please be patient or alternatively run in nohup mode and redirect output to a file)

db2 -v "select substr(TABSCHEMA,1,30) TABSCHEMA, substr(TABNAME,1,40) TABNAME, DBPARTITIONNUM from SYSIBMADM.ADMINTABINFO where LOAD_STATUS in ('PENDING','IN_PROGRESS') with ur"  

Alternatively, we can use below command as well to get the status of a single table.

db2_all "db2 -v connect to <databasename>; db2 -v load query table <schema.tablename>"



To bring the table into normal state.

As a DBA execute below command.
db2 -v "load from /dev/null of del terminate into schema.tablename nonrecoverable"

(or)

Ask the Developer, to execute the same command with terminate option



What will happen to the existing records in my table when a DBA terminates Load as per above approach?

It will NOT impact any of the existing records in the table. However, the intermediate rows which are loaded by the current load will be deleted from the table.

No comments:

Post a Comment