ITeye博客

批量移动表和索引的表空间

foohsinglong · 2011-01-26 15:38 · DataBase · 编程语言 · Markdown

--1.修改表的空间 
alter table table_Name move tablespace TABLESPACENAME 

--查询当前用户下的所有表 
select 'alter table  '|| table_name ||'  move tablespace cjlogistics;'  from user_all_tables; 

--2.修改表的索引的空间 
alter index INDEX_NAME rebuild tablespace TABLESPACENAME 

--查询当前用户下的所有索引 
select 'alter index '|| index_name ||' rebuild tablespace cjlogistics;' from user_indexes; 

--3.用于移动lob索引表空间
SELECT 'alter table ' || t.owner || '.' || t.table_name ||' move tablespace cjlogistics lob (' || t.column_name ||') store as(tablespace LOBTPS_NAME_MOVEBK);' v_sql FROM dba_lobs t 
 WHERE t.tablespace_name='CJLOGISTICS';

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。