Home > Database > Mysql Tutorial > 关于move table和rebuild index批量操作的记录

关于move table和rebuild index批量操作的记录

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:53:38
Original
1354 people have browsed it

关于move table和rebuild index批量操作的记录

Linux公社

首页 → 数据库技术

背景:

阅读新闻

关于move table和rebuild index批量操作的记录

[日期:2015-07-15] 来源:Linux社区  作者:静以致远√团团 [字体:]

批量move oldtablespace表空间下的table到newtablespace,查询并执行查询结果即可

select 'alter table '||table_name||' move tablespace newtablespace'

from user_all_tables 

where table_space='oldtablespace';

批量rebuild oldtablespace表空间下的index到newtablespace,,查询并执行查询结果即可

select 'alter index '|| index_name || ' rebuild  tablespace newtablespace;'
 from user_indexes
 where  tablespace_name='oldtablespace' ;

带有lob字段的表做move时lob字段需要单独move

ALTER TABLE AUDIT_RECORD MOVE LOB(lobrow1) STORE AS (TABLESPACE newtablespace);

ALTER TABLE AUDIT_RECORD MOVE LOB(lobrow2) STORE AS (TABLESPACE newtablespace);
 

ALTER TABLE AUDIT_RECORD MOVE TABLESPACE newtablespace;

 

或者
ALTER TABLE test2 MOVE

              TABLESPACE users

                  LOB (lobrow1) STORE AS lobsegment

              (TABLESPACE newtablespace);

另外exp/imp迁移带有lob字段的  在执行IMP时需要将原lob字段所在的tablespace建好再导入,导入后再考虑move到其他tablespace

exped/imped可以用remap_tablespace参数指定将数据导入到指定的表空间,无需考虑该项

本文永久更新链接地址

  • 0
  • MySQL 主备库切换记录

    MySQL操作规范(总结)

    相关资讯       move table  rebuild index 

    图片资讯      

    本文评论   查看全部评论 (0)

    评论声明

    最新资讯

    本周热门

    Linux公社简介 - 广告服务 - 网站地图 - 帮助信息 - 联系我们
    本站(LinuxIDC)所刊载文章不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。


    Copyright © 2006-2015 Linux公社 All rights reserved 沪ICP备15008072号-1号

    Related labels:
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Issues
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template