zoukankan      html  css  js  c++  java
  • 四个脚本,用于表和索引转移表空间的操作

    /*该脚本可以生成SQL,将SQL粘出来,就可以执行了*/

    --转移普通表的表空间
    select 'alter table ' || t1.table_name || ' move tablespace NEW_TBS;'
    from user_all_tables t1
    where t1.tablespace_name = 'OLD_TBS';

    --转移分区表的表空间
    select 'alter table ' || t1.table_name || move partition ' ||
    t2.partition_name || ' tablespace NEW_TBS;' || chr(13) ||
    'commit;'
    from user_all_tables t1, user_tab_partitions t2
    where t1.table_name = t2.table_name
    and t2.tablespace_name = 'OLD_TBS';

    --转移普通索引
    select 'alter index' || t.INDEX_NAME || ' rebuild tablespace NEW_TBS;'
    from user_indexes t
    where t.index_type = 'NORMAL'
    and t.DROPPED = 'NO'
    and t.TABLE_NAME in
    (select a.table_name
    from user_all_tables a
    where a.tablespace_name = 'OLD_TBS');

    --转移分区索引
    select 'alter index ' || t1.index_name || ' rebuild partition ' ||
    t2.partition_name || 'tablespace NEW_TBS;'
    from user_indexes t1, user_ind_partitions t2
    where t1.INDEX_NAME = t2.index_name
    and t2.tablespace_name = 'OLD_TBS'

  • 相关阅读:
    Beta 冲刺(7/7)
    Beta 冲刺(6/7)
    Beta 冲刺(5/7)
    Beta 冲刺(4/7)
    Beta 冲刺(3/7)
    Beta 冲刺(2/7)
    Beta 冲刺(1/7)
    福大软工 · 第十次作业
    Adobe acrobat DC 2020 激活方法
    物理八年级下册2
  • 原文地址:https://www.cnblogs.com/wingsless/p/2269401.html
Copyright © 2011-2022 走看看