Db2 rename table 报错SQL0750N

问题描述:

Db2 rename table的时候报错 SQL0750N

inst105@node01:~$ db2 "rename table tb1 to tb1_bak"
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0750N  The statement failed because the table or column cannot be renamed.  
SQLSTATE=42986
 

原因分析:

inst105@node01:~$ db2 " ? SQL0750N"


SQL0750N  The statement failed because the table or column cannot be
      renamed.

Explanation: 

The source table in a RENAME statement cannot be renamed for one or more
of the following reasons.

*  The table is referenced in one or more existing materialized query
   tables.

*  The table is involved in one or more referential constraints as a
   parent or dependent table.

*  The table is a target table for decomposition of one or more XSR
   objects.

*  The table is a system-period temporal table.

*  The table is a history table.

*  The database manager configuration parameter auto_reval is set to
   DISABLED and one of the following occurred:

   *  The table is referenced in one or more existing views.

   *  The table is referenced in one or more existing triggers. This
      includes triggers on the table or references in triggered SQL
      statements.

   *  The table is referenced in one or more existing SQL functions or
      SQL methods.

   *  The table has check constraints defined. This includes check
      constraints caused by generated columns.

*  The table is the latency table, SYSTOOLS.REPL_MQT_LATENCY.

 

问题解决:

本次问题的原因在于AUTO_REVAL当前值为DISABLED,并且使用db2look查看发现该表上有视图

inst105@node01:~$ db2pd -db sample -dbcfg | grep -i AUTO_REVAL
AUTO_REVAL                     DISABLED             DISABLED  

inst105@node01:~$ db2look -d sample -a -e -t tb1 | grep -i create
-- Generate statistics for all creators 
-- The db2look utility will consider only the specified tables 
-- Creating DDL for table(s)
-- This CLP file was created using DB2LOOK Version "10.5" 
CREATE TABLE "INST105 "."TB1"  (
create view vtb1 as select * from tb1;


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值