impdp导入报错ORA-39325 ORA-39112
$ impdp \'/ as sysdba\' parfile=impdp.par
Import: Release 11.2.0.4.0 - Production on Fri Apr 16 11:05:43 2021Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Master table "SYS"."IMPDP_TSCX_CKTS01" successfully loaded/unloaded
Starting "SYS"."IMPDP_TSCX_CKTS01": "/******** AS SYSDBA" parfile=impdp_tscx_ckts01_20210415.par
Processing object type TABLE_EXPORT/TABLE/TABLE
ORA-39325: TABLE_EXISTS_ACTION cannot be applied to "xiaohong"."test01".
ORA-39325: TABLE_EXISTS_ACTION cannot be applied to "xiaohong"."test02".
ORA-39325: TABLE_EXISTS_ACTION cannot be applied to "xiaohong"."test03".
ORA-39325: TABLE_EXISTS_ACTION cannot be applied to "xiaohong"."test04".
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/COMMENT
ORA-39112: Dependent object type COMMENT skipped, base object type TABLE:"xiaohong"."test01" creation failed
...
$
报错:
- TABLE_EXISTS_ACTION参数无法应用于
*.*
表 - 已跳过依赖对象类型注释,基本对象类型表:
*.*
表创建失败 (注释不影响导入结果,忽略即可)
原因: 具有相同名称的对象会阻止导入作业创建表
解决:
1、在运行datapump导入前,删除现有对象
#查看目标库是否存在该对象:
col OBJECT_NAME for a30
select owner,object_name,object_type from dba_objects
where object_name in ('test01','test02','test03','test04');OWNER OBJECT_NAME OBJECT_TYPE
----------------------- ----------------------- -------------------
xiaohong test01 SYNONYM
xiaohong test02 SYNONYM
xiaohong test03 SYNONYM
xiaohong test04 SYNONYMSQL>
查看对象类型,原来是同义词
删除同义词:(全局同义词就加PUBLIC
)
DROP [PUBLIC] SYNONYM [schema.]sysnonym_name
#数据库中操作:
drop SYNONYM xiaohong.test01;
drop SYNONYM xiaohong.test02;
drop SYNONYM xiaohong.test03;
drop SYNONYM xiaohong.test04;
2、覆盖导入
如果对象是表,可以在导入文件中加参数覆盖该表(table_exists_action=replace)
table_exists_action其他参数及其作用参数append :向表增加数据
skip :跳过存在表(默认值)
truncate :截断表(清除数据保留表结构)再向表增加数据
replace :删除已经存在表,并重新建表,再向表增加数据
一定要慎用replace,truncate
!