查看表属性
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).