您现在的位置是:首页 >

db2创建索引指定索引空间 Oracle表、索引修改表空间语句

火烧 2021-07-09 18:52:32 1055
Oracle表、索引修改表空间语句   表做空间迁移时 使用如下语句   例 alter ta le t _ ame move ta le ace t _ ame   索引表空间做迁移 使用如下语句

Oracle表、索引修改表空间语句  

  表做空间迁移时 使用如下语句

  例 alter table tb_name move tablespace tbs_name;

  索引表空间做迁移 使用如下语句

db2创建索引指定索引空间 Oracle表、索引修改表空间语句

  例 alter index index_name rebuild tablespace tbs_name;

  对于含有lob字段的表 在建立时 oracle会自动为lob字段建立两个单独的segment 一个用来存放数据 另一个用来存放索引 并且它们都会存储在对应表指定的表空间中 而例 只能移动非lob字段以外的数据 所以在对含有lob字段的表进行空间迁移 需要使用如下语句

  例 alter table tb_name move tablespace tbs_name lob (col_lob col_lob ) store as(tablesapce tbs_name);

  项目实例

  表空间迁移

  select alter table ||table_name|| move tablespace tbs_name; table_name from dba_tables where owner= %***% and table_name like %***%

  带lob字段

  select alter table ||table_name|| move lob( ||index_name|| ) store as (tablespace tbs_name); from dba_indexes where owner= %***% and index_name like %***%

  索引表空间

  select alter index ||index_name|| rebuild tablespace tbs_name; index_name from dba_indexes where owner= %***% and table_name like %***%

lishixinzhi/Article/program/Oracle/201311/18067  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码