简体   繁体   English

Oracle SQL - 使用 expdp/impdp 将数据从非分区(常规表)导入空分区表

[英]Oracle SQL - Import data from non-partitioned (regular table) into an empty partitioned table using expdp/impdp

Oracle version - 12.2.0.1 OS version - 7.1 Exadata box. Oracle 版本 - 12.2.0.1 操作系统版本 - 7.1 Exadata 盒。

I have a table with 5 million rows into a regular table (non-partitioned) and my client has created an empty structure of the above table (partitioned by date).我有一个包含 500 万行的表进入常规表(未分区),我的客户创建了上述表的空结构(按日期分区)。 Now, he wants to export(expdp) the data from original table (non-partitioned) and import (impdp) into the partitioned table and wants the data to go into the partitions accordingly.现在,他想将原始表(非分区)中的数据导出(expdp)并导入(impdp)到分区表中,并希望将 go 的数据相应地放入分区中。 Is this achievable?这是可以实现的吗?

Please let me know if this is achievable through any method?请让我知道这是否可以通过任何方法实现?

Thank you,谢谢,

A normal datapump with TABLE_EXISTS_ACTION=APPEND will take care of it assuming the table has already been created in the target schema.假设已经在目标模式中创建了表,则具有 TABLE_EXISTS_ACTION=APPEND 的普通数据泵将处理它。

If you have a table that is already loaded and is unpartitioned, there is the 'alter table' option as mentioned, which lets you define the partitionined schema for both table and indexes, and do it online如果您有一个加载且未分区的表,则可以使用前面提到的“alter table”选项,它允许您为表和索引定义分区模式,并在线执行

SQL> alter table T modify
  2  partition by range (object_id) interval (10000)
  3  (
  4    partition p1 values less than (20000)
  5  ) online
  6  update indexes
  7  ( ix  local,
  8    ix2 global partition by range (created)
  9    (
 10      partition ix2_p1 values less than (date '2016-08-01'),
 11      partition ix2_p2 values less than (maxvalue)
 12    )
 13  );

Table altered.

I'm confused, you use the tag oracle10g, but mention 12.2 in the question?我很困惑,您使用标签 oracle10g,但在问题中提到 12.2?

Yes, this will work, on two conditions:是的,这将在两个条件下起作用:

  1. It is clear into which partition each row will be sorted.很清楚每一行将被排序到哪个分区。 Unless you use system partitioning ( PARTITION BY SYSTEM ), that should be fine.除非您使用系统分区( PARTITION BY SYSTEM ),否则应该没问题。

  2. All the necessary partitions do exist.所有必要的分区确实存在。 Either your client uses interval partitions (for instance PARTITION BY RANGE (my_date) INTERVAL (NUMTOYMINTERVAL(1,'MONTH')) ), or they set up partitions to cover all dates in the unpartitioned table.您的客户端要么使用间隔分区(例如PARTITION BY RANGE (my_date) INTERVAL (NUMTOYMINTERVAL(1,'MONTH')) ),要么他们设置分区以覆盖未分区表中的所有日期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Hive上对未分区的表进行分区? - How to partition a non-partitioned table on Hive? 将当前月份的分区表中的数据插入到oracle中的非分区表中 - insert data from current month of partitioned table to a non partitioned table in oracle 我可以用函数 mr 返回一个非分区表吗? - Can I return a non-partitioned table with function mr? 对分区表的Postgres查询比非分区表慢2倍 - Postgres query on partitioned table 2x slower than non-partitioned table Oracle SQL从每日分区的表中提取选定日期的数据 - Oracle SQL pull data for a selected date from a table that is daily partitioned 如何使用merge语句将临时表中的数据插入oracle/sql中的分区表中 - How insert data from a temporary table into partitioned table in oracle/sql using merge statement 非分区表上的分区索引 - partitioned index on a non partitioned table 将数据从一个分区表复制到另一个新的分区表 - copy data from one partitioned table to another new partitioned table 如何在 ORACLE 中交换分区。 ORA-14095: ALTER TABLE EXCHANGE 需要非分区、非聚集表 - How I can to exchange partition in ORACLE. ORA-14095: ALTER TABLE EXCHANGE requires a non-partitioned, non-clustered table 对Google bigquery中的非分区数据进行计数 - Doing a running count on non-partitioned data in Google bigquery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM