OS环境:linux 5.4
数据库版本:oracle 11.2.0
今天同事给我两个DMP文件,是以DATA_ONLY模式导出的表,然后要我导入到CCXE用户下的CCXE表空间下,我的导入命令如下
impdp ccxe/****@FI directory=king DUMPFILE=RR_JYRESEARCHREPORT.DMP tables='(RR_JYRESEARCHREPORT)' job_name=king
Import: Release 11.2.0.1.0 - Production on Mon May 16 20:45:34 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39002: invalid operation
ORA-39166: Object CCXE.RR_JYRESEARCHREPORT was not found.
导入的过程中有报错信息,提示内容是找不到CCXE用户下RR_JYRESEARCHREPORT这个表,开始我以为是directory的设置问题,但是我重建directory后依然报错,最后通过使用metalink的查询,该报错的意思是dmp文件内无法找到属于CCXE用户下CCXE.RR_JYRESEARCHREPORT表,通过和同事沟通,最后才得知该表是从TRANUSER用户下TRANUSER表空间内导出的,找到瓶颈了。看来虽然数据是以DATA_ONLY模式导出的,但是数据内依然记得自己所属的是哪个表空间和用户,如果想解决该问题,需要使用参数REMAP重新定义该表的所属用户和所属表空间,命令如下,执行该命令,导入成功。
impdp ccxe/****@FI DIRECTORY=KING DUMPFILE=RR_JYRESEARCHREPORT.DMP TABLES='(TRANUSER.RR_JYRESEARCHREPORT)' REMAP_SCHEMA=TRANUSER:CCXE REMAP_TABLESPACE=TRANUSER:CCXE job_name=king0516
Import: Release 11.2.0.1.0 - Production on Mon May 16 22:31:07 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "CCXE"."KING0516" successfully loaded/unloaded
Starting "CCXE"."KING0516": ccxe/********@FI DIRECTORY=KING DUMPFILE=RR_JYRESEARCHREPORT.DMP TABLES=(TRANUSER.RR_JYRESEARCHREPORT) REMAP_SCHEMA=TRANUSER:CCXE REMAP_TABLESPACE=TRANUSER:CCXE job_name=king0516
Processing
object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "CCXE"."RR_JYRESEARCHREPORT" 75.77 GB 235122 rows
Job "CCXE"."KING0516" successfully completed at 07:10:50
解决Oracle数据库导入DMP文件时ORA-39166错误
在尝试将DATA_ONLY模式导出的Oracle表RR_JYRESEARCHREPORT导入到CCXE用户下的CCXE表空间时遇到ORA-39166错误。错误原因是DMP文件中的表信息仍关联原用户和表空间。通过使用impdp命令的REMAP_SCHEMA和REMAP_TABLESPACE参数,将表的所有权和表空间映射到目标用户和表空间,成功解决了问题。
1967





