从dump文件中导入一张表时报 ORA-39151错误

来源:互联网 发布:slack linux 编辑:程序博客网 时间:2024/05/29 02:09
用impdp命令从一个全schema的dump文件中 导入其中一张表的过程:
首先用下面命令实验,
-bash-3.2$ impdp system/oracle005@SELADEVS directory=DB_BAK dumpfile=PROD_SELAPRODS_SIEBEL_20130905.dmp tables=SIEBE                                          L.s_per_resp  logfile=s_per_resp.imp.log

Import: Release 11.2.0.3.0 - Production on Fri Sep 6 11:23:46 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TABLE_01":  system/********@SELADEVS directory=DB_BAK dumpfile=PROD_SELAPRODS_SIEBEL_2                                          0130905.dmp tables=SIEBEL.s_per_resp logfile=s_per_resp.imp.log
Processing object type SCHEMA_EXPORT/TABLE/TABLE
ORA-39151: Table "SIEBEL"."S_PER_RESP" exists. All dependent metadata and data will be skipped due to table_exists_a                                          ction of skip
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_TABLE_01" completed with 1 error(s) at 11:24:01
结果报ORA-39151错误
网上查了些资料,在后面加上两个参数 SKIP_UNUSABLE_INDEXES=Y TABLE_EXISTS_ACTION=SKIP
SKIP_UNUSABLE_INDEXED 是否跳过不可使用的索引
TABLE_EXISTS_ACTION 当表已存在是执行的操作
skip|append|truncate|replace
运行结果如下:
-bash-3.2$ impdp system/oracle005@SELADEVS directory=DB_BAK dumpfile=PROD_SELAPRODS_SIEBEL_20130905.dmp tables=SIEBE                                          L.s_per_resp  logfile=s_per_resp.imp.log SKIP_UNUSABLE_INDEXES=Y TABLE_EXISTS_ACTION=SKIP

Import: Release 11.2.0.3.0 - Production on Fri Sep 6 11:36:18 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TABLE_01":  system/********@SELADEVS directory=DB_BAK dumpfile=PROD_SELAPRODS_SIEBEL_2                                          0130905.dmp tables=SIEBEL.s_per_resp logfile=s_per_resp.imp.log SKIP_UNUSABLE_INDEXES=Y TABLE_EXISTS_ACTION=SKIP
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Table "SIEBEL"."S_PER_RESP" exists. All dependent metadata and data will be skipped due to table_exists_action of sk                                          ip
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_TABLE_01" successfully completed at 11:36:26

结果显示,报错是没有了,但到表中查数据,记录根本没导进来,
后来研究了一下加的两个参数,发现把TABLE_EXISTS_ACTION 改成truncate模式,数据就导进来了,
-bash-3.2$ impdp system/oracle005@SELADEVS directory=DB_BAK dumpfile=PROD_SELAPRODS_SIEBEL_20130905.dmp tables=SIEBE                                          L.s_per_resp  logfile=s_per_resp.imp.log SKIP_UNUSABLE_INDEXES=Y TABLE_EXISTS_ACTION=TRUNCATE

Import: Release 11.2.0.3.0 - Production on Fri Sep 6 11:46:26 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TABLE_01":  system/********@SELADEVS directory=DB_BAK dumpfile=PROD_SELAPRODS_SIEBEL_2                                          0130905.dmp tables=SIEBEL.s_per_resp logfile=s_per_resp.imp.log SKIP_UNUSABLE_INDEXES=Y TABLE_EXISTS_ACTION=TRUNCATE                                          
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Table "SIEBEL"."S_PER_RESP" exists and has been truncated. Data will be loaded but all dependent metadata will be sk                                          ipped due to table_exists_action of truncate
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SIEBEL"."S_PER_RESP"                       140.8 KB    1481 rows
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_TABLE_01" successfully completed at 11:46:37
原创粉丝点击