0

0

DB2 表空间简单说明

php中文网

php中文网

发布时间:2016-06-13 08:50:56

|

1361人浏览过

|

来源于php中文网

原创

精美淘宝客单页面 zblog模板
精美淘宝客单页面 zblog模板

采用zblog修改的模板,简单方便,直接解压上传到空间即可使用,页面简单,适合SEO,导航,次导航,最新文章列表,随机文章列表全部都有,网站采用扁平结构,非常适用淘宝客类小站,所有文章都在根目录下。所有需要修改的地方在网页上各个地方都有标注说明,一切在网站后台都可以修改,无须修改任何程序代码,是新手的不二选择。后台登陆地址: 域名/login.asp用户名:admin (建议不要修改)密码:adm

下载

db2 表空间简单说明

一、新建测试库:

[db2inst2@localhost shell]$ db2 "create database ghan on /db2inst2/db2inst2 using codeset utf-8 territory cn collate using system"
db20000i create database 命令成功完成。

[db2inst2@localhost shell]$ db2 connect to ghan


数据库连接信息


数据库服务器 = db2/linuxx8664 9.7.5
sql 授权标识 = db2inst2
本地数据库别名 = ghan


[db2inst2@localhost shell]$




二、新建缓冲池:

[db2inst2@localhost shell]$ db2 "create bufferpool bp32k pagesize 32k"
db20000i sql 命令成功完成。
[db2inst2@localhost shell]$


db2inst2@localhost ~]$ db2 "select * from syscat.bufferpools"


bpname bufferpoolid dbpgname npages pagesize estore numblockpages blocksize ngname
-------------------------------------------------------------------------------------------------------------------------------- ------------ -------------------------------------------------------------------------------------------------------------------------------- ----------- ----------- ------ ------------- ----------- --------------------------------------------------------------------------------------------------------------------------------
ibmdefaultbp 1 - -2 4096 n 0 0 -
bp32k 2 - -2 32768 n 0 0 -


2 条记录已选择。



三、新建数据库管理(dms)大表空间

[db2inst2@localhost shell]$ db2 -tsvf create_tabs.sql
create large tablespace tbs_data pagesize 32k managed by database using (file '/db2inst2/data_tb/cont0' 100m, file '/db2inst2/data_tb/cont1' 100m) extentsize 32 prefetchsize automatic bufferpool bp32k no file system caching
db20000i sql 命令成功完成。

[db2inst2@localhost shell]$ cd /db2inst2/data_tb/
[db2inst2@localhost data_tb]$ ll
总计 205008
-rw------- 1 db2inst2 db2inst2 104857600 10-20 08:48 cont0
-rw------- 1 db2inst2 db2inst2 104857600 10-20 08:48 cont1
[db2inst2@localhost data_tb]$


1、重设dms表空间大小
alter tablespace tbs_data extend (file '/db2inst2/data_tb/cont0' 100m, file '/db2inst2/data_tb/cont1' 500m)

四、新建临时表空间


[db2inst2@localhost shell]$ db2 "create temporary tablespace tbs_temp pagesize 32k managed by system using ('/db2inst2/data_tb/tab_temp') bufferpool bp32k"
db20000i sql 命令成功完成。
[db2inst2@localhost shell]$

[db2inst2@localhost tab_temp]$ db2 "create user temporary tablespace tbs_usertemp pagesize 32k managed by system using ('/db2inst2/data_tb/tab_usertemp') bufferpool bp32k"
db20000i sql 命令成功完成。
[db2inst2@localhost tab_temp]$

五、新建自动管理表空间

[db2inst2@localhost tab_temp]$ db2 "create tablespace tab_data2 initialsize 100m increasesize 100m maxsize 10g"
db20000i sql 命令成功完成。
[db2inst2@localhost tab_temp]$
[db2inst2@localhost tab_temp]$ db2 "create tablespace tab_data3 pagesize 32k bufferpool bp32k"
db20000i sql 命令成功完成。
[db2inst2@localhost tab_temp]$

六、新建dms管理表空间

create tablespace tab_sp4 managed by database using (file '/db2inst2/data_tb/tab_sp4' 100m)

七、添加数据库层自动管理存储

[db2inst2@localhost autodb]$ db2 "alter database ghan add storage on '/db2inst2/autodb'"
db20000i sql 命令成功完成。
[db2inst2@localhost autodb]$ db2pd -d ghan -storagepaths




八、将dms表空间修改来自动存储管理表空间


[db2inst2@localhost t0000008]$ db2 " alter tablespace tab_sp4 managed by automatic storage"
db20000i sql 命令成功完成。
[db2inst2@localhost t0000008]$ db2 "alter tablespace tab_sp4 rebalance"
db20000i sql 命令成功完成。
[db2inst2@localhost t0000008]$ db2pd -d ghan -tablespaces


[db2inst2@localhost ~]$ db2pd -d ghan -tablespaces


database partition 0 -- database ghan -- active -- up 0 days 00:00:05 -- date 10/22/2015 03:02:24


tablespace configuration:
address id type content pagesz extentsz auto prefetch bufid bufiddisk fsc numcntrs maxstripe lastconsecpg name
0x00002b810664e400 0 dms regular 4096 4 yes 4 1 1 off 1 0 3 syscatspace
0x00002b810664fb80 1 sms systmp 4096 32 yes 64 1 1 on 2 0 31 tempspace1
0x00002b81066534c0 2 dms large 4096 32 yes 32 1 1 off 1 0 31 userspace1
0x00002b8106654c40 3 dms large 4096 4 yes 4 1 1 off 1 0 3 systoolspace
0x00002b81066563c0 4 dms large 32768 32 yes 64 2 2 off 2 0 31 tbs_data
0x00002b8106657d40 5 sms systmp 32768 32 yes 32 2 2 on 1 0 31 tbs_temp
0x00002b810665b480 6 sms usrtmp 32768 32 yes 32 2 2 on 1 0 31 tbs_usertemp
0x00002b810665ebc0 7 dms large 4096 32 yes 64 1 1 off 2 0 31 tab_data2
0x00002b8106660540 8 dms large 32768 32 yes 64 2 2 off 2 0 31 tab_data3
0x00002b8106661ec0 9 dms large 4096 32 yes 64 1 1 off 2 0 31 tab_sp4


tablespace statistics:
address id totalpgs usablepgs usedpgs pndfreepgs freepgs hwm max hwm state minrectime nquiescers pathsdropped
0x00002b810664e400 0 24576 24572 22884 0 1688 22884 22884 0x00000000 0 0 no
0x00002b810664fb80 1 2 2 2 0 0 0 0 0x00000000 0 0 no
0x00002b81066534c0 2 8192 8160 96 0 8064 96 96 0x00000000 0 0 no
0x00002b8106654c40 3 8192 8188 152 0 8036 152 152 0x00000000 0 0 no
0x00002b81066563c0 4 6400 6336 96 0 6240 96 96 0x00000000 0 0 no
0x00002b8106657d40 5 1 1 1 0 0 0 0 0x00000000 0 0 no
0x00002b810665b480 6 1 1 1 0 0 0 0 0x00000000 0 0 no
0x00002b810665ebc0 7 51200 51136 96 0 51040 96 96 0x00000000 0 0 no
0x00002b8106660540 8 2048 1984 96 0 1888 96 96 0x00000000 0 0 no
0x00002b8106661ec0 9 256 192 96 0 96 96 96 0x00000000 0 0 no


tablespace autoresize statistics:
address id as ar initsize incsize iip maxsize lastresize lrf
0x00002b810664e400 0 yes yes 33554432 -1 no none none no
0x00002b810664fb80 1 yes no 0 0 no 0 none no
0x00002b81066534c0 2 yes yes 33554432 -1 no none none no
0x00002b8106654c40 3 yes yes 33554432 -1 no none none no
0x00002b81066563c0 4 no no 0 0 no 0 none no
0x00002b8106657d40 5 no no 0 0 no 0 none no
0x00002b810665b480 6 no no 0 0 no 0 none no
0x00002b810665ebc0 7 yes yes 104857600 104857600 no 10737418240 none no
0x00002b8106660540 8 yes yes 33554432 -1 no none none no
0x00002b8106661ec0 9 yes yes 786432 -1 no none none no


containers:
address tspid containnum type totalpgs useablepgs pathid stripeset container
0x00002b810664f940 0 0 file 24576 24572 0 0 /db2inst2/db2inst2/db2inst2/node0000/ghan/t0000000/c0000000.cat
0x00002b8106651060 1 0 path 1 1 0 0 /db2inst2/db2inst2/db2inst2/node0000/ghan/t0000001/c0000000.tmp
0x00002b8106651270 1 1 path 1 1 1 0 /db2inst2/autodb/db2inst2/node0000/ghan/t0000001/c0000001.tmp
0x00002b8106654a00 2 0 file 8192 8160 0 0 /db2inst2/db2inst2/db2inst2/node0000/ghan/t0000002/c0000000.lrg
0x00002b8106656180 3 0 file 8192 8188 0 0 /db2inst2/db2inst2/db2inst2/node0000/ghan/t0000003/c0000000.lrg
0x00002b8106657900 4 0 file 3200 3168 - 0 /db2inst2/data_tb/cont0
0x00002b8106657b10 4 1 file 3200 3168 - 0 /db2inst2/data_tb/cont1
0x00002b8106659220 5 0 path 1 1 - 0 /db2inst2/data_tb/tab_temp
0x00002b810665c960 6 0 path 1 1 - 0 /db2inst2/data_tb/tab_usertemp
0x00002b8106660100 7 0 file 25600 25568 0 0 /db2inst2/db2inst2/db2inst2/node0000/ghan/t0000007/c0000000.lrg
0x00002b8106660310 7 1 file 25600 25568 1 0 /db2inst2/autodb/db2inst2/node0000/ghan/t0000007/c0000001.lrg
0x00002b8106661a80 8 0 file 1024 992 0 0 /db2inst2/db2inst2/db2inst2/node0000/ghan/t0000008/c0000000.lrg
0x00002b8106661c90 8 1 file 1024 992 1 0 /db2inst2/autodb/db2inst2/node0000/ghan/t0000008/c0000001.lrg
0x00002b8106663400 9 0 file 128 96 0 0 /db2inst2/db2inst2/db2inst2/node0000/ghan/t0000009/c0000000.lrg
0x00002b8106663610 9 1 file 128 96 1 0 /db2inst2/autodb/db2inst2/node0000/ghan/t0000009/c0000001.lrg




九、关于表空间quiesce测试

[db2inst2@localhost ~]$ db2 quiesce tablespaces for table empl share
db20000i quiesce tablespaces 命令成功完成

[db2inst2@localhost ~]$ db2 -tsvf create-tm.sql
create table empldd (eno integer, lastname varchar(30),hiredate date, salary integer) in tab_sp4
db21034e 该命令被当作 sql
语句来处理,因为它是无效的“命令行处理器”命令。在 sql
处理期间,它返回:
sql0290n 不允许访问表空间。 sqlstate=55039




表空间标识 = 9
名称 = tab_sp4
类型 = 数据库管理空间
内容 = 所有持久数据。大型表空间。
状态 = 0x0001
详细解释:
已停顿:share
总计页数 = 8448
可用页数 = 8384
已用页数 = 5504
可用页数 = 2880
高水位标记(页) = 5504
页大小(以字节计) = 4096
扩展数据块大小(页) = 32
预取大小(页) = 64
容器数 = 2
停顿者的数目 = 1
停顿者 1 :
表空间标识 = 9
对象标识 = 4



[db2inst2@localhost ~]$ db2 quiesce tablespaces for table empl reset
db20000i quiesce tablespaces 命令成功完成。
[db2inst2@localhost ~]$ db2 -tsvf create-tm.sql
create table empldd (eno integer, lastname varchar(30),hiredate date, salary integer) in tab_sp4
db20000i sql 命令成功完成。


[db2inst2@localhost ~]$

表空间标识 = 9
名称 = tab_sp4
类型 = 数据库管理空间
内容 = 所有持久数据。大型表空间。
状态 = 0x0000
详细解释:
正常
总计页数 = 8448
可用页数 = 8384
已用页数 = 5568
可用页数 = 2816
高水位标记(页) = 5568
页大小(以字节计) = 4096
扩展数据块大小(页) = 32
预取大小(页) = 64
容器数 = 2

[db2inst2@localhost ~]$ db2 drop table empl
db20000i sql 命令成功完成。
[db2inst2@localhost ~]$ db2 list tablespaces show detail

表空间标识 = 9
名称 = tab_sp4
类型 = 数据库管理空间
内容 = 所有持久数据。大型表空间。
状态 = 0x0000
详细解释:
正常
总计页数 = 8448
可用页数 = 8384
已用页数 = 160
可用页数 = 8224
高展数据块大小(页) = 32
预取大小(页) = 64
容器数 = 2


[db2inst2@localhost ~]$ db2 "alter tablespace tab_sp4 lower high water mark"
db20000i sql 命令成功完成。



表空间标识 = 9
名称 = tab_sp4
类型 = 数据库管理空间
内容 = 所有持久数据。大型表空间。
状态 = 0x0000
详细解释:
正常
总计页数 = 8448
可用页数 = 8384
已用页数 = 160
可用页数 = 8224
高水位标记(页) = 160
页大小(以字节计) = 4096
扩展数据块大小(页) = 32
预取大小(页) = 64
容器数 = 2


水位标记(页) = 5568
页大小(以字节计) = 4096


[db2inst2@localhost ~]$ db2 -tsvf showtables
select substr(tbsp_name,1,20) as tablespace_name,substr(tbsp_content_type,1,10) as tablespace_type,sum(tbsp_total_size_kb)/1024 as total_mb,sum(tbsp_used_size_kb)/1024 as used_mb,sum(tbsp_free_size_kb)/1024 as free_mb,tbsp_page_size as page_size from sysibmadm.tbsp_utilization group by tbsp_name,tbsp_content_type,tbsp_page_size order by 1


tablespace_name tablespace_type total_mb used_mb free_mb page_size
-------------------- --------------- -------------------- -------------------- -------------------- -----------
syscatspace any 96 89 6 4096
systoolspace large 32 0 31 4096
tab_data2 large 200 0 199 4096
tab_data3 large 64 3 59 32768
tab_sp4 large 33 0 32 4096
tbs_data large 200 3 195 32768
tbs_temp systemp 0 0 0 32768
tbs_usertemp usrtemp 0 0 0 32768
tempspace1 systemp 0 0 0 4096
userspace1 large 32 0 31 4096


10 条记录已选择。
[db2inst2@localhost ~]$ db2 -tsvf insert.sql
insert into empl with dt(eno) as (values(1) union all select eno+1 from dt where eno db21034e 该命令被当作 sql
语句来处理,因为它是无效的“命令行处理器”命令。在 sql
处理期间,它返回:
sql0289n 未能在表空间 "tbs_data" 中分配新页面。 sqlstate=57011

[db2inst2@localhost ~]$ db2 -tsvf showtables
select substr(tbsp_name,1,20) as tablespace_name,substr(tbsp_content_type,1,10) as tablespace_type,sum(tbsp_total_size_kb)/1024 as total_mb,sum(tbsp_used_size_kb)/1024 as used_mb,sum(tbsp_free_size_kb)/1024 as free_mb,tbsp_page_size as page_size from sysibmadm.tbsp_utilization group by tbsp_name,tbsp_content_type,tbsp_page_size order by 1


tablespace_name tablespace_type total_mb used_mb free_mb page_size
-------------------- --------------- -------------------- -------------------- -------------------- -----------
syscatspace any 96 89 6 4096
systoolspace large 32 0 31 4096
tab_data2 large 200 0 199 4096
tab_data3 large 64 3 59 32768
tab_sp4 large 33 0 32 4096
tbs_data large 200 198 0 32768
tbs_temp systemp 0 0 0 32768
tbs_usertemp usrtemp 0 0 0 32768
tempspace1 systemp 0 0 0 4096
userspace1 large 32 0 31 4096


10 条记录已选择。
[db2inst2@localhost ~]$

表空间标识 = 4
名称 = tbs_data
类型 = 数据库管理空间
内容 = 所有持久数据。大型表空间。
状态 = 0x0000
详细解释:
正常
总计页数 = 6400
可用页数 = 6336
已用页数 = 6336
可用页数 = 0
高水位标记(页) = 6336
页大小(以字节计) = 32768
扩展数据块大小(页) = 32
预取大小(页) = 64
容器数 = 2


dms表空间添加容器:

alter tablespace tbs_data extend (file '/db2inst2/data_tb/cont0' 100m, file '/db2inst2/data_tb/cont1' 500m)


相关标签:

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
Word 字间距调整方法汇总
Word 字间距调整方法汇总

本专题整合了Word字间距调整方法,阅读下面的文章了解更详细操作。

2

2025.12.24

任务管理器教程
任务管理器教程

本专题整合了任务管理器相关教程,阅读下面的文章了解更多详细操作。

2

2025.12.24

AppleID格式
AppleID格式

本专题整合了AppleID相关内容,阅读专题下面的文章了解更多详细教程。

0

2025.12.24

csgo视频观看入口合集
csgo视频观看入口合集

本专题整合了csgo观看入口合集,阅读下面的文章了知道更多入口地址。

29

2025.12.24

yandex外贸入口合集
yandex外贸入口合集

本专题汇总了yandex外贸入口地址,阅读下面的文章了解更多内容。

58

2025.12.24

添加脚注通用方法
添加脚注通用方法

本专题整合了添加脚注方法合集,阅读专题下面的文章了解更多内容。

1

2025.12.24

重启电脑教程汇总
重启电脑教程汇总

本专题整合了重启电脑操作教程,阅读下面的文章了解更多详细教程。

3

2025.12.24

纸张尺寸汇总
纸张尺寸汇总

本专题整合了纸张尺寸相关内容,阅读专题下面的文章了解更多内容。

5

2025.12.24

Java Spring Boot 微服务实战
Java Spring Boot 微服务实战

本专题深入讲解 Java Spring Boot 在微服务架构中的应用,内容涵盖服务注册与发现、REST API开发、配置中心、负载均衡、熔断与限流、日志与监控。通过实际项目案例(如电商订单系统),帮助开发者掌握 从单体应用迁移到高可用微服务系统的完整流程与实战能力。

1

2025.12.24

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Excel 教程
Excel 教程

共162课时 | 9.3万人学习

Java 教程
Java 教程

共578课时 | 36.8万人学习

Uniapp从零开始实现新闻资讯应用
Uniapp从零开始实现新闻资讯应用

共64课时 | 6.4万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号