oracle 分区表move和包含分区表的lob move
表包含lob字段,需要收回空间,首先move表,move表,move完表后lob的空间并不会释放,还需要针对lob字段进行move:
非分区表lob的move:
alter table T_SEND_LOG move lob(MESSAGE) store as (tablespace DATALOB);
分区表lob的move:
alter table T_SEND_LOG move partition p2018 lob(MESSAGE) store as (tablespace DATALOB);
分区表move:
alter table T_SEND_LOG move partition p2018;
move表后记得rebuild索引。
批量生成语句参考:
针对表空间:
select 'alter table '||a.owner||'.'||a.table_name||' move lob('||a.COLUMN_NAME||') store as (tablespace DATALOB);'
from dba_lobs a,DBA_SEGMENTS b where a.owner in ('APP')
and a.OWNER=b.OWNER and a.SEGMENT_NAME=b.SEGMENT_NAME and b.TABLESPACE_NAME!='PACSLOB';
针对表:
select 'alter table '||a.owner||'.'||a.table_name||' move lob('||a.COLUMN_NAME||') store as (tablespace DATALOB);'
from dba_lobs a,DBA_SEGMENTS b where a.owner in ('APP')
and a.OWNER=b.OWNER and a.SEGMENT_NAME=b.SEGMENT_NAME and a.TABLE_NAME = 'T_SEND_LOG';