在执行SQL语句时,遇到这个错误,百度了一番,出现这个错误的原因是我们之前对修改过这个表,我的具体操作是使用alter table语句删除了表中的某一个列,导致这个表处于重组挂起状态,需要使用REORG TABLE语句重构表,但是在SQL命令端是无法直接执行REORG TABLE XXX语句的,需要通过调用数据库自带的存储过程来执行这一命令,语句如下:
call Sysproc.admin_cmd('REORG TABLE 表名');
参考原文:
Operation not allowed for reason code reason-code on table table-name.
Explanation: Access to table table-name is restricted. The cause is based on the following reason codes reason-code: 7
The table is in the reorg pending state. This can occur after an ALTER TABLE statement containing a REORG-recommended operation.7
Reorganize the table using the REORG TABLE command (note that INPLACE REORG TABLE is not allowed for a table that is in the reorg pending state).