移植表空间
alter table TABLE_NAME move tablespace TABLESPACENAME
将数据从一个表空间移植到另一个表空间
select 'alter table ' ||table_name || ' move tablespace systemportal;' from user_all_tables where tablespace_name='OA';
当导完数据后需要重新建立索引 否则报错
1. select index_name from user_indexes where status = 'UNUSABLE' 查询失效索引 2. alter index 索引名 rebuild; 重新建立索引
如果失效索引太多 那么可以执行以下过程
1. 2. declare 3. vc_index_name varchar2(100); --索引名称 4. cursor index_cur is 5. select index_name from user_indexes where status = 'UNUSABLE'; --获取当前登录用户所有不可用的索引 6. begin 7. open index_cur; 8. fetch index_cur into vc_index_name; 9. loop 10. exit when not index_cur%found; 11. --dbms_output.put_line(vc_index_name); 12. execute immediate 'alter index '||vc_index_name||' rebuild'; 13. fetch index_cur into vc_index_name; 14. end loop; 15. close index_cur; 16. end;