创建SMS类型表空间:
db2 => create tablespace TBS_SMS \
db2 (cont.) => managed by system \
db2 (cont.) => using('demo')
DB20000IThe SQL command completed successfully.
需要注意:SMS类型即系统管理表空间,指定容器时,只能指定目录名(本例中demo就是目录名),就是我们特别指定的目录名。以后在该表空间上建表、索引等对象时,所产生的数据文件,均存放在我们指定的目录下。
1、查看表空间容器
下面我们查看下,这个目录存放的全路径。
首先查看,表空间的id号:
db2 => list tablespaces
Tablespaces for Current Database
Tablespace ID= 0
Name= SYSCATSPACE
Type= Database managed space
Contents= All permanent data. Regular table space.
State= 0x0000
Detailed explanation:
Normal
。。。。。。。。。。。。。。。。。
Tablespace ID= 5
Name= TBS_SMS
Type= System managed space
Contents= All permanent data. Regular table space.
State= 0x0000
Detailed explanation:
Normal
查看到我们新建的表空间的id号是5之后,我们查看容器即可找到,demo的全路径。可以看到是在/NODE0000/SQL00003目录下新建的文件夹。SQL00003是我们创建数据库demo时,自动创建的,像我们“定制”的一些数据,默认就会创建在该目录下。
db2 => list tablespace containers for 5 show detail
Tablespace Containers for Tablespace 5