db2操作从分区表DETACH下来的临时表报错

DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor.

 During SQL processing it returned:

SQL20285N  The statement or command was not processed either because the table named 'TEST.TABLE1_PART20200313'

has detached dependent tables or because an asynchronous partition detach operation on the table is not complete.Reason

code="2". SQLSTATE=55057

以上错误是在操作从分区表中DETACH下来的临时表时报出的错误,经分析错误原因为若DETACH下来的分区资源尚未完全释放时

操作临时表的话即会抛出此异常。

通过查询db2帮助命令也可得知问题原因:

db2 ? 55057

SQLSTATE 55057:The statement or command is not allowed while the table has detached dependents or until the asynchronous

partition detach task completes.

db2  ?  SQL20285N

SQL20285N  The statement or command was not processed either because the table named "" hass detached

dependent tables or because an asynchronous partition detach operation on the table is not complete.Reason Code =

"".

The specific reason this message was returned is indicated by the value of the runtime token "":

1   The table is the target table of a detach operation and has detached dependents which are required to be incrementally

maintained with respects to the current content of this table in order to preserve the integrity of the detached dependents.The

statement or command is not allowed because execution of the statement or command would prevent the detached dependents

from being incrementally maintained.

2   The table is the target table of a detach operation and is not available because the asychronous partition detach task has not

completed.

3   The table is the source table of a detach operation and has logically detached partitions.The statement or command is not

allowed because the asynchronous partition detach task has not completed.

4   The table has detached partitions and there are dependent tables that need to be incrementally maintained with respect to

these detached partitions.The statement is not allowed because execution of the statement or command would incalidate the

incremental maintentance of the dependent table.

解决方法如下:

针对错误码2解决方法:使用list utilities命令监控卸载分区进程执行情况,直至卸载分区命令执行完成,再继续操作即可。

 

你可能感兴趣的:(DB2,java)