导入分区表的某分区报错: ORA-39151: Table "SYSTEM"."T_PART" exists.

分区表的导出/导入实验过程如下:

1. 创建测试分区表

CREATE TABLE "SYSTEM"."T_PART"
   ("OWNER" VARCHAR2(30),
  "SEGMENT_NAME" VARCHAR2(81),
  "PARTITION_NAME" VARCHAR2(30),
  "SEGMENT_TYPE" VARCHAR2(18),
  "SEGMENT_SUBTYPE" VARCHAR2(10),
  "TABLESPACE_NAME" VARCHAR2(30),
  "HEADER_FILE" NUMBER,
  "HEADER_BLOCK" NUMBER,
  "BYTES" NUMBER,
  "BLOCKS" NUMBER,
  "EXTENTS" NUMBER,
  "INITIAL_EXTENT" NUMBER,
  "NEXT_EXTENT" NUMBER,
  "MIN_EXTENTS" NUMBER,
  "MAX_EXTENTS" NUMBER,
  "MAX_SIZE" NUMBER,
  "RETENTION" VARCHAR2(7),
  "MINRETENTION" NUMBER,
  "PCT_INCREASE" NUMBER,
  "FREELISTS" NUMBER,
  "FREELIST_GROUPS" NUMBER,
  "RELATIVE_FNO" NUMBER,
  "BUFFER_POOL" VARCHAR2(7),
  "FLASH_CACHE" VARCHAR2(7),
  "CELL_FLASH_CACHE" VARCHAR2(7)
   )  partition by hash(segment_type)
( partition p1
, partition p2
, partition p3
, partition p4
);
insert into t_part select * from dba_segments;
commit;

2. 导出分区表

[[email protected] expdp]$ expdp system/oracle  tables=t_part directory=expdp logfile=expdp_t_part.log job_name=1
...
. . exported "SYSTEM"."T_PART":"P1"                      144.7 KB     953 rows
. . exported "SYSTEM"."T_PART":"P2"                      31.17 KB     114 rows
. . exported "SYSTEM"."T_PART":"P3"                      118.1 KB     781 rows
. . exported "SYSTEM"."T_PART":"P4"                      466.4 KB    3604 rows
Master table "SYSTEM"."1" successfully loaded/unloaded

随后将T_PART表删除:

SQL> DROP TABLE T_PART PURGE;

3. 导入测试1(分区p2)

[[email protected] expdp]$ impdp system/oracle directory=expdp dumpfile=expdat.dmp logfile=impdp_t_part2.log job_name=2  tables=t_part:p2
...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SYSTEM"."T_PART":"P2"                      31.17 KB     114 rows  <<<<<<<<===========只有分区p2数据被导入
Job "SYSTEM"."2" successfully completed at Sat Dec 27 12:30:50 2014 elapsed 0 00:00:05

此时,检查T_PART的表结构,可看到p1,p2,p3,p4分区都已被自动创建,因为导入时候会自动创建表结构,所有分区都是表的结构中一部分。

4. 导入测试2(分区p3)

[[email protected] expdp]$ impdp system/oracle directory=expdp dumpfile=expdat.dmp logfile=impdp_t_part3.log job_name=3 tables=t_part:p3
...
ORA-39151: Table "SYSTEM"."T_PART" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Job "SYSTEM"."3" completed with 1 error(s) at Sat Dec 27 12:32:16 2014 elapsed 0 00:00:03

TABLE_EXISTS_ACTION默认是skiped,意为如果IMPDP检测到待导的表名已存在于数据中,则略过。添加参数重来一遍:

[[email protected] expdp]$ impdp system/oracle directory=expdp dumpfile=expdat.dmp logfile=impdp_t_part3.log job_name=3  tables=t_part:p3 TABLE_EXISTS_ACTION=append
...
Processing object type TABLE_EXPORT/TABLE/TABLE
Table "SYSTEM"."T_PART" exists. Data will be appended to existing table but all dependent metadata will be skipped due to table_exists_action of append
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SYSTEM"."T_PART":"P3"                      118.1 KB     781 rows
Job "SYSTEM"."3" successfully completed at Sat Dec 27 12:33:47 2014 elapsed 0 00:00:11

有关TABLE_EXISTS_ACTION参数的说明如下:

TABLE_EXISTS_ACTION={SKIP | APPEND | TRUNCATE | REPLACE}

The possible values have the following effects:
?
SKIP leaves the table as is and moves on to the next object. This is not a valid option if the CONTENT parameter is set to DATA_ONLY.

?
APPEND loads rows from the source and leaves existing rows unchanged.

?
TRUNCATE deletes existing rows and then loads rows from the source.

?
REPLACE drops the existing table and then creates and loads it from the source. This is not a valid option if the CONTENT parameter is set to DATA_ONLY.

至此,在分区表的导出导入实验中,通过添加TABLE_EXISTS_ACTION=APPEND来解决了ORA-39151。

可以将表的每个分区当作是一张表来理解。

时间: 2024-07-29 22:27:27

导入分区表的某分区报错: ORA-39151: Table "SYSTEM"."T_PART" exists.的相关文章

Linux 格式化分区 报错Could not stat --- No such file or directory 和 partprobe 命令

分区的过程正常: [[email protected] /]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot      Start         End      Blocks   Id  System /dev/sda1   *

expdp报错ora 39126

11.2.0.2,expdp报错: ORA-39126: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS []ORA-31642: the following SQL statement fails:BEGIN "SYS"."DBMS_CUBE_EXP".SCHEMA_CALLOUT(:1,0,1,'11.02.00.00.00'); END;ORA-06512: at &quo

导入MySQL测试数据库employee报错

导入MySQL测试数据库employee 报错 下载地址:https://launchpad.net/test-db/ 上传解压: [[email protected] ~]# tar xf employees_db-full-1.0.6.tar.bz2 [[email protected] ~]# cd employees_db 使用mysql命令行工具,导入建库建表语句和数据 employee.sql中是建库建表语句,默认使用的是InnoDB引擎,可以自行修改 [[email protect

Navicat导入数据时发生了报错 --- 1153 - Got a packet bigger than &#39;max_allowed的处理办法

今天我在使用Navicat导入.sql文件数据时,发现本来是80万条的数据,结果只导入了10万条左右,而且在其错误信息日志中,我发现了这样一条错误:1153 - Got a packet bigger than 'max_allowed. 度娘了一番后,发现越来是我的SQL文件远远大于MySQL默认执行的文件大小,所以执行不过去. 解决方法: 在MySQL安装目录下找到文件my.ini,搜索[mysqld],在其下面添加一句话 max_allowed_packet=521M  ##该处按照自己的

partprobe分区报错

环境 centos 6.9 vmware 虚拟机 场景: 对磁盘进行在线扩容,扩容后,在线扫描,扫描过后进行LVM扩展,分区后,通过partprobe /dev/sda 扫描,出现以下错误: 分区报错shell > partprobe /dev/sdaWarning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it ma

vscode Python 无法导入beautifulsoup4解决方案 (bs4报错:vscode unresolved import &#39;beautifulsoup4&#39;)

猜测:应该是vscode没有找到IDLE安装的bs4路径,或者没有成功加载 方案1 1.重新下载bs4,将其解压到所需工作的目录下 2.重启vscode 方案2 1.在VScode终端安装bs4 :pip install beautifulsoup4 2.将settings.json文件内容 { "python.pythonPath": "E:\\Python3.6\\python.exe" } 删除重新写一遍E:\\Python3.6\\python.exe不需更

git报错:&#39;fatal:remote origin already exists&#39;怎么处理?附上git常用操作以及说明。

git添加远程库的时候有可能出现如下的错误, 怎么解决? 只要两步: 1.先删除 $ git remote rm origin 2.再次执行添加就可以了. ----------------------------------------------git常用操作------------------------------------------------ 说明,以下整理来自廖雪峰大神的<git教程>. 各位童鞋要下载git但是网速不给力的,可以从这里下载:https://pan.baidu.

Mysql报错 :Unknown table engine &#39;InnoDB&#39; &nbsp;

问题: zabbix服务器重启后,进入zabbix的web发现登录不进去并且网页报mysql的错误,查看mysql的日之后,发现报错: [[email protected] ~]# tail -f /var/log/mysqld.log 140820 16:24:43 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 33

git报错:&#39;fatal:remote origin already exists

git报错:'fatal:remote origin already exists'怎么处理?附上git常用操作以及说明. git添加远程库的时候有可能出现如下的错误, 怎么解决? 只要两步: 1.先删除 1 $ git remote rm origin 2.再次执行添加就可以了. ----------------------------------------------git常用操作------------------------------------------------ 说明,以下整