一、oracle 移动分区表到指定表空间,及修改表的默认表空间
1、修改分区表的默认表空间:
select ‘alter table ‘||table_name||’ modify default attributes tablespace TSDAT01′ from dba_tables where table_name in (‘T’);
查询出的语句直接执行
2、移动现有分区到其他表空间
begin
for x in(select TABLE_OWNER,table_name,partition_name from dba_tab_partitions where table_name in (‘T’))
loop
execute immediate ‘alter table ‘||x.table_owner||’.’||x.table_name||’ move partition ‘ || x.partition_name || ‘ tablespace users’;
end loop;
end;
/
二、Oracle修改表Table所属表空间及Clob、Blob字段的处理
SELECT TABLE_NAME,TABLESPACE_NAME FROM USER_TABLES — WHERE TABLE_NAME=’test’ –可以加上条件
SELECT ‘alter table ‘||TABLE_NAME||’ move tablespace TEST_TS;’ FROM USER_TABLES WHERE TABLESPACE_NAME = ‘USERS’;
SELECT ‘alter index ‘|| INDEX_NAME ||’ rebuild tablespace TEST_TS;’ FROM user_indexes;
ALTER TABLE TEST2 MOVE TABLESPACE USERS LOB(col_lob1,col_lob2) STORE AS(TABLESPACE TEST_TS);
转自:https://www.cnblogs.com/ayumie/p/10910312.html