今天创建长字段表报错,特测试如下:
db2inst1@suselinux:/opt/ibm/db2/V9.7> db2 "create table lengthtest(
> name varchar(16785)
> )";
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0286N A default table space could not be found with a page size of at
least "32768" that authorization ID "DB2INST1" is authorized to use.
SQLSTATE=42727
原因:表空间的page size 默认为4K的,建一个page size 32K的表空间,然后在上面建表
解决方法:
一、先创建32K 的bufferpool
db2inst1@suselinux:/opt/ibm/db2/V9.7> db2 "create bufferpool pool32k size 100 pagesize 32k";
DB20000I The SQL command completed successfully.
二、然后在32K 的bufferpool 上创建32k 的TABLESPACE
db2inst1@suselinux:~> db2 "CREATE TABLESPACE tbspace32k PAGESIZE 32K MANAGED BY DATABASE USING ( FILE '/opt/ibm/db2/V9.7/tbspace32k' 5120)
> EXTENTSIZE 8 OVERHEAD 10.5 PREFETCHSIZE 8 TRANSFERRATE 0.14 BUFFERPOOL pool32k";
DB20000I The SQL command completed successfully.
三、最后在32k 的TABLESPACE 上创建表
db2inst1@suselinux:~> db2 "create table lengthtest(
> name varchar(16785)
> )";
DB20000I The SQL command completed successfully.
阅读(1925) | 评论(1) | 转发(0) |