db2 SQL

查看表属性

db2 describe table 表名

例如 db2 describe dbi.HDCFG


查看某条记录的值

db2 "select dbname,serverinstname,hastatus,updatetime from dbi.hdtblinf where serverinstname like '%Hmaster%' and HAStatus<>'active' and HAStatus<>'standby'"


查看参数用法

db2 "LIST COMMAND OPTIONS"


赋权语句

db2 "GRANT SELECT,UPDATE,DELETE,INSERT ON TABLE DBI.HDALM TO USER test_user"


更改HDHSTINF表中SWAPMEMORYUSAGE数据格式由DOUBLE改为VARCHAR(200)

db2 "ALTER TABLE DBI.HDHSTINF ALTER COLUMN SWAPMEMORYUSAGE SET DATA TYPE VARCHAR(200)"


对HDHSTINF表做ALTER操作后,数据无法正常入库。

报错:SQL0668N Operation not allowed for reason code "7" on table HDHSTINF

执行db2 " reorg dbi.hdhstinf"后,数据可以正常入库

原文解释为: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).


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值