设为首页 加入收藏

TOP

DB2表空间管理详解(三)
2014-11-23 18:59:09 来源: 作者: 【 】 浏览:96
Tags:DB2 空间 管理 详解
00MB,最大大小为100GB的 自动存储管理表空间
create tablespace tbs_data2 initialsize 100M increasesize 100M maxsize 100G
9、查看表空间信息
list tablespaces
list tablespaces show detail
db2pd -d testdb -tablespaces
get snapshot for tablespaces on testdb
也可以查看sysibmadm.snaptbsp和sysibmadm.snapcontainer这两个视图
10、查看表空相关的容器信息
list tablespace containers for 7 #tablespace id
list tablespace containers for 7 show detail
11、如果DMS表空间对应的存储中还有未分配空间,可通过alter tablespace的extend、reduce或resize选项扩展已有表空间容器的大小。其中extend用来扩展容器大小,reduce用来缩减已有容器大小,resize重新设定容器大小。对于reduce和resize,需确保更改后的表空间有足够空间,否则DB2拒绝操作。
alter tablespace tbs_data extend (file '/database/tbs_data/cont0' 10M)
12、如果表空间容器已经没有剩余空间,可通过add选项增加容器,当然必要的情况下也可以通过drop选项删除容器。对于add和drop操作会在容器间发生数据重新平衡(rebalance)。如果数据量很大,rebalance时间有可能很久,对系统可能造成很大影响。

alter tablespace tbs_data add(file '/database/tbs_data/cont2' 100m)
13、如果使用begin new strip set选项则会在现有容器空间用完时使用新增容器,该选项使数据不会在容器间做rebalance,但会造成数据偏移。
alter tablespace tbs_data begin new stripe set (file '/database/tbs_data/cont3' 100m)

14、查看自动存储管理表空间路径
db2pd -d testdb -storagepaths
15、对于自动存储管理表空间,无法在表空间级进行容器更改,只能在数据级别,因为自动存储路径是在建库时指定的。可以使用add storage on选项为数据库添加新的存储路径。在v9.7版本之前,自动存储路径只能增加,不能删除。新增加的存储路径不会备表空间立即使用,只有在已有存储路径文件系统空间满了,才会使用新增路径,增加路径只是为了解决容量问题。v9.7版本之后,只要对使用自动存储管理的表空间执行rebalance,则该表空间可以立即使用新增存储路径。

alter database testdb add storage on '/database/czm'
alter tablespace 7 rebalance


16、将DMS表空间转换成自动存储管理表空间
alter tablespace tbs_data managed by automatic storage
alter tablespace tbs_data rebalance



参考至:《DB2数据库最佳管理实践》徐明伟著
http://www.ibm.com/developerworks/cn/data/library/techarticles/0212wieser/0212wieser. html
http://www.2cto.com/database/201201/116270.html

本文原创,转载请注明出处、作者
如有错误,欢迎指正
邮箱:czmcj@163.com
首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇DB2函数大全 下一篇DB2第一步 ― 创建表

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: