Load Pending state

DB2

During a LOAD operation, you might get the following DB2 error:
TEXT: [IBM][CLI Driver][DB2/LINUXX8664] SQL0668N Operation not allowed for reason 
code "3" on table <schema_name>.<table_name>. SQLSTATE=57016

SQL0668N reason code 3 indicates that the table is in the Load Pending state. It also indicates that a previous LOAD attempt on this table resulted in failure. You cannot access the table until the LOAD operation is restarted or terminated.

You can use queries to detect and remove the Load Pending state.

You can use the following query to detect the Load Pending state:
Select TABSCHEMA, TABNAME, LOAD_STATUS from SYSIBMADM.ADMINTABINFO where 
load_status = 'PENDING' and tabschema = '<schema_name>'"

You must restart or terminate the previously failed LOAD operation on this table by issuing LOAD with the RESTART or TERMINATE option.

You can use the following query to terminate the Load Pending state:
db2 load from /dev/null of del terminate into <schema_name>.<table_name> nonrecoverable
Example:
$ db2 connect to PV
$ db2 "select TABSCHEMA, TABNAME, LOAD_STATUS from SYSIBMADM.ADMINTABINFO where 
load_status = 'PENDING' and tabschema = 'PV_METRIC'"
$ db2 load from /dev/null of del terminate into PV_METRIC.CO2_1MGA_000_S0 nonrecoverable
$ db2 disconnect PV