db2表空间常用命令

创建表空间
 

create LARGE TABLESPACE MY_TB_32K
  PAGESIZE 32K
  MANAGED BY DATABASE
  USING(FILE '/home/db2inst1/tbs/MY_TB_32K' 1048756K)
  EXTENSIZE 32
  BUFFERPOOL BP32K
  OVERHEAD 7.5
  TRANSFERRATE 0.06

删除表空间

drop tablespace MY_TB_32K

查看表空间使用情况

db2pd -d dbname -tablespaces
db2 list tablespaces show detail
db2 list tablespace containers for 4 show detail


设置表空间自动扩展

db2 alter tablespace ZX_DATA_32K AUTORESIZE YES

手工扩扩展表空间有3种方法:

--扩展容器50G
db2 "alter tablespace tablespace_name extend (file '/data1/ts2/con0' 50G,file '/data1/ts2/con1' 50G)"
--2增加容器,不过会rebalance,影响系统性能
db2 "alter tablespace tablespacename add (file '/data1/ts2/con2' 50G)"
--通过alter tablespace begin new stripe set 选项,该选项不rebalance,不会对系统性能造成影响,但它会造成数据偏移。
db2 "alter tablespace tablespace_name begin new stripe set (file '/data1/ts2/con3' 10G)"


 

你可能感兴趣的:(db2)