oracle实战技巧(二)oracle的表空间迁移
【摘要】
移植表空间
alter table TABLE_NAME move tablespace TABLESPACENAME
将数据从一个表空间移植到另一个表空间
select 'alter table ' ||table_name || ' move tablespace systemportal;' from user_all_ta...
移植表空间
alter table TABLE_NAME move tablespace TABLESPACENAME
将数据从一个表空间移植到另一个表空间
select 'alter table ' ||table_name || ' move tablespace systemportal;' from user_all_tables where tablespace_name='OA';
当导完数据后需要重新建立索引 否则报错
select index_name from user_indexes where status = 'UNUSABLE' 查询失效索引
alter index 索引名 rebuild; 重新建立索引
如果失效索引太多 那么可以执行以下过程
declare
vc_index_name varchar2(100); --索引名称
cursor index_cur is
select index_name from user_indexes where status = 'UNUSABLE'; --获取当前登录用户所有不可用的索引
begin
open index_cur;
fetch index_cur into vc_index_name;
loop
exit when not index_cur%found;
--dbms_output.put_line(vc_index_name);
execute immediate 'alter index '||vc_index_name||' rebuild';
fetch index_cur into vc_index_name;
end loop;
close index_cur;
end;
文章来源: baocl.blog.csdn.net,作者:小黄鸡1992,版权归原作者所有,如需转载,请联系作者。
原文链接:baocl.blog.csdn.net/article/details/107084858
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)