首页 > 开发 > 综合 > 正文

移动LOB类型数据段

2024-07-21 02:34:18
字体:
来源:转载
供稿:网友
    使用如下语法:ALTER TABLE MOVE TABLESPACE LOB () STORE AS (TABLESPACE );    其中STORE AS 修改LOB segment段名字的方法,我在817.3的测试中没有效果;而且还导致表也被Moved(注重测试中ROWID的改变).     当分区包括LOB时候,语法稍有不同;    alter table move partition lob () store as ( tablespace )    具体参考http://asktom.Oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:378418239571SQL> CREATE TABLE loBTab (
recid NUMBER(5),
lobcol CLOB )
LOB (lobcol) STORE AS (TABLESPACE USERS)
TABLESPACE USERS; 2 3 4 5Table created.SQL> desc lobtab
Name Null? Type
----------------------------------------- -------- ----------
RECID NUMBER(5)
LOBCOL CLOBSQL> select index_name, tablespace_name,index_type from user_indexes where table_name = 'LOBTAB';INDEX_NAME TABLESPACE_NAME
------------------------------ ------------------------------
INDEX_TYPE
---------------------------
SYS_IL0000119374C00002$$ USERS
LOBLOB Index必须和LOB Segment在一个表空间中。察看有用的*_lobs视图SQL> select table_name,column_name,segment_name,index_name from user_lobs;LOBTAB LOBCOL
SYS_LOB0000119374C00002$$ SYS_IL0000119374C00002$$SQL> select rowid from lobtab;ROWID
------------------
AAAdJRACiAAAACqAAA 《---目前表纪录的rowid    移动LOB SegmentSQL> ALTER TABLE lobtab MOVE LOB (lobcol) STORE AS lobseg (TABLESPACE TOOLS);Table altered.SQL> select rowid from lobtab;ROWID
------------------
AAAdKeACjAAAABqAAA <---rowid改变;虽然表的表空间没有变,但表确实也被move了。SQL> select index_name, tablespace_name,index_type from user_indexes where table_name = 'LOBTAB';INDEX_NAME TABLESPACE_NAME
------------------------------ ------------------------------
INDEX_TYPE
---------------------------
SYS_IL0000119374C00002$$ TOOLS
LOB    没有发现LOBSEG,看来语法没有起作用。SQL> SELECT segment_name, segment_type, tablespace_name FROM user_segments where segment_name IN ('LOBTAB', 'LOBSEG');SEGMENT_NAME
--------------------------------------------------------------------------------
SEGMENT_TYPE TABLESPACE_NAME
------------------ ------------------------------
LOBTAB
TABLE USERSSQL> select table_name,column_name,segment_name,index_name from user_lobs;LOBTAB LOBCOL
SYS_LOB0000119374C00002$$ SYS_IL0000119374C00002$$

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表