建立含有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); 下面來看一個例子吧
SQL>select OWNER,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_segments where owner="TEST6"OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME----- ------------------------------ ------------------ ------------------------TEST6 TEST_LOB TABLE TESTTEST6 SYS_IL0000015539C00001$$ LOBINDEX TESTTEST6 SYS_IL0000015539C00002$$ LOBINDEX TESTTEST6 SYS_LOB0000015539C00001$$ LOBSEGMENT TESTTEST6 SYS_LOB0000015539C00002$$ LOBSEGMENT TESTSQL>alter table test6.test_lob move tablespace test1Table altered.SQL>select OWNER,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_segments where owner="TEST6"OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME----- ------------------------------ ------------------ ------------------------TEST6 TEST_LOB TABLE TEST1TEST6 SYS_IL0000015539C00001$$ LOBINDEX TESTTEST6 SYS_IL0000015539C00002$$ LOBINDEX TESTTEST6 SYS_LOB0000015539C00001$$ LOBSEGMENT TESTTEST6 SYS_LOB0000015539C00002$$ LOBSEGMENT TESTSQL>ALTER TABLE TEST6.TEST_LOB MOVE TABLESPACE TEST1 LOB(A,B) STORE AS(TABLESPACE TEST1);Table altered.SQL>select OWNER,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_segments where owner="TEST6";OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME----- ------------------------------ ------------------ ------------------------TEST6 TEST_LOB TABLE TEST1TEST6 SYS_IL0000015539C00001$$ LOBINDEX TEST1TEST6 SYS_IL0000015539C00002$$ LOBINDEX TEST1TEST6 SYS_LOB0000015539C00001$$ LOBSEGMENT TEST1TEST6 SYS_LOB0000015539C00002$$ LOBSEGMENT TEST1
建立含有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); 下面來看一個例子吧
SQL>select OWNER,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_segments where owner="TEST6"OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME----- ------------------------------ ------------------ ------------------------TEST6 TEST_LOB TABLE TESTTEST6 SYS_IL0000015539C00001$$ LOBINDEX TESTTEST6 SYS_IL0000015539C00002$$ LOBINDEX TESTTEST6 SYS_LOB0000015539C00001$$ LOBSEGMENT TESTTEST6 SYS_LOB0000015539C00002$$ LOBSEGMENT TESTSQL>alter table test6.test_lob move tablespace test1Table altered.SQL>select OWNER,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_segments where owner="TEST6"OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME----- ------------------------------ ------------------ ------------------------TEST6 TEST_LOB TABLE TEST1TEST6 SYS_IL0000015539C00001$$ LOBINDEX TESTTEST6 SYS_IL0000015539C00002$$ LOBINDEX TESTTEST6 SYS_LOB0000015539C00001$$ LOBSEGMENT TESTTEST6 SYS_LOB0000015539C00002$$ LOBSEGMENT TESTSQL>ALTER TABLE TEST6.TEST_LOB MOVE TABLESPACE TEST1 LOB(A,B) STORE AS(TABLESPACE TEST1);Table altered.SQL>select OWNER,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_segments where owner="TEST6";OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME----- ------------------------------ ------------------ ------------------------TEST6 TEST_LOB TABLE TEST1TEST6 SYS_IL0000015539C00001$$ LOBINDEX TEST1TEST6 SYS_IL0000015539C00002$$ LOBINDEX TEST1TEST6 SYS_LOB0000015539C00001$$ LOBSEGMENT TEST1TEST6 SYS_LOB0000015539C00002$$ LOBSEGMENT TEST1