【问题标题】:How to change partitioned table into non-partitioned table in oracle along with data and indexes?如何在oracle中将分区表与数据和索引一起更改为非分区表?
【发布时间】:2017-09-18 10:41:36
【问题描述】:

我通过以下方式做到了这一点:

  1. Oracle 数据泵 (expdp/impdp) 实用程序与选项 PARTITION_OPTIONS=merge 的帮助。
  2. 还有ALTER TABLE t1 MERGE PARTITIONS p01 TO p04 INTO p0;我在这里成功合并,但都存储在一个分区中,我不希望这样。)
  3. 随数据一起创建表的临时副本,删除原始表并将临时表名称重命名为原始表。 (这种方法可能不适合海量数据

但是在这里我想知道的是,有没有什么方法可以从 SQL> 使用 oneliner 命令/语句提示来实现这一点?因此,数据可以存储在表/表空间中而无需任何分区。

【问题讨论】:

    标签: database oracle


    【解决方案1】:

    第一个解决方案:

    进行分区交换,假设您有以下分区表:

    create table tpart (
      x int,
     y int
    ) partition by range (x) (
      partition p0 values less than (10),
     partition p1 values less than (20)
    );
    

    创建一个具有相同列的新非分区表:

    create table new_table(
      x int,
     y int
    );
    

    然后用新表交换你的分区:

    alter table tpart exchange partition p0 with table new_table including indexes update indexes;
    alter table tpart exchange partition p1 with table new_table including indexes update indexes;
    

    第二种解决方案:

    在没有分区的情况下在目标架构中预创建表,并使用 datapump 导入数据:table_exists_action=append

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-09
      • 1970-01-01
      • 2017-12-11
      • 1970-01-01
      • 2016-11-07
      • 1970-01-01
      • 2019-05-11
      • 2013-06-02
      相关资源
      最近更新 更多