很多人都知道在建立含有lob字段的表时,Oracle会自动为lob字段建立两个单独的segment,一个用来存放数据,另一个用来存放索引,并且它们都会存储在对应表指定的表空间中。但是当我们用alter table tb_name move tablespace tbs_name;来对表做空间迁移时只能移动非lob字段以外的数据,而如果需要同时移动lob相关字段的数据,就必需用如下的含有特殊参数据的语句来完成。
alter table tb_name move tablespace tbs_name
lob (col_lob1,col_lob2) store as(tablesapce tbs_name);
下面是一个具体的示例:
Connected to Oracle8i Enterprise Edition Release 8.1.7.0.0
Connected as scott
SQL> desc test_blob;
NameTypeNullable Default Comments
--------- ------------ -------- ------- --------
FILE_NAME VARCHAR2(25) Y
FILE_BINBLOBY
FILE_BIN2 BLOBY
SQL>
SQL> select t.segment_name, t.segment_type, t.tablespace_name
2from sys.user_segments t
3where t.segment_name like 'SYS_%'
4/
SEGMENT_NAMESEGMENT_TYPETABLESPACE_NAME
-----------------