如何使导入顺利完成!
2011-08-17 11:28
381 查看
当做 exp导入的时候可能会遇到约束的问题而不能进行导入。
可以使用下面的办法来禁止约束从而使导入顺利完成!
在导入的时候遇到如下问题:
Column 30 MOS
IMP-00019: row rejected due to ORACLE error 2291
IMP-00003: ORACLE error 2291 encountered
ORA-02291: integrity constraint (CMDB.CI_ELEMENT_LOCATION) violated - parent key not found
处理步骤如下:
SQL> create table cmdb.configuration_item_bak as select * from cmdb.configuration_item;
Table created.
SQL> alter table cmdb.configuration_item disable primary key;
alter table cmdb.configuration_item disable primary key
*
ERROR at line 1:
ORA-02297: cannot disable constraint (CMDB.PK_CONFIGURATION_ITEM) -
dependencies exist
SQL> alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM;
alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM
*
ERROR at line 1:
ORA-02297: cannot disable constraint (CMDB.PK_CONFIGURATION_ITEM) -
dependencies exist
SQL> alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM cascade;
Table altered.
SQL> alter table cmdb.configuration_item disable primary key;
Table altered.
SQL> alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM ;
Table altered.
原以为这样做导入就应该没有问题了:)
imp / file=cmdb.dmp fromuser=cmdb touser=cmdb ignore=y
可问题依旧?
为什么呢。原来这里的约束错误是因为违反了文件里要导入数据的约束条件,这与是否禁止表上面的约束无关。
只是因为表中已经有了和文件里一样的数据导致在导入的时候违反了文件里的约束。
所以可以通过清除表里数据的办法来完成导入。
truncate table cmdb.configuration_item ;
然后导入:
-bash-3.00$ imp / file=cmdb.dmp fromuser=cmdb touser=cmdb ignore=y
Import: Release 11.2.0.2.0 - Production on Wed Aug 17 03:27:17 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning option
Export file created by EXPORT:V11.02.00 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses US7ASCII character set (possible charset conversion)
. importing CMDB's objects into CMDB
. . importing table "CONFIGURATION_ITEM" 21171 rows imported
可以使用下面的办法来禁止约束从而使导入顺利完成!
在导入的时候遇到如下问题:
Column 30 MOS
IMP-00019: row rejected due to ORACLE error 2291
IMP-00003: ORACLE error 2291 encountered
ORA-02291: integrity constraint (CMDB.CI_ELEMENT_LOCATION) violated - parent key not found
处理步骤如下:
SQL> create table cmdb.configuration_item_bak as select * from cmdb.configuration_item;
Table created.
SQL> alter table cmdb.configuration_item disable primary key;
alter table cmdb.configuration_item disable primary key
*
ERROR at line 1:
ORA-02297: cannot disable constraint (CMDB.PK_CONFIGURATION_ITEM) -
dependencies exist
SQL> alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM;
alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM
*
ERROR at line 1:
ORA-02297: cannot disable constraint (CMDB.PK_CONFIGURATION_ITEM) -
dependencies exist
SQL> alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM cascade;
Table altered.
SQL> alter table cmdb.configuration_item disable primary key;
Table altered.
SQL> alter table cmdb.configuration_item disable constraint PK_CONFIGURATION_ITEM ;
Table altered.
原以为这样做导入就应该没有问题了:)
imp / file=cmdb.dmp fromuser=cmdb touser=cmdb ignore=y
可问题依旧?
为什么呢。原来这里的约束错误是因为违反了文件里要导入数据的约束条件,这与是否禁止表上面的约束无关。
只是因为表中已经有了和文件里一样的数据导致在导入的时候违反了文件里的约束。
所以可以通过清除表里数据的办法来完成导入。
truncate table cmdb.configuration_item ;
然后导入:
-bash-3.00$ imp / file=cmdb.dmp fromuser=cmdb touser=cmdb ignore=y
Import: Release 11.2.0.2.0 - Production on Wed Aug 17 03:27:17 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning option
Export file created by EXPORT:V11.02.00 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses US7ASCII character set (possible charset conversion)
. importing CMDB's objects into CMDB
. . importing table "CONFIGURATION_ITEM" 21171 rows imported
相关文章推荐
- 在Myeclipse中完成代码自动填充,自动提示功能的方法:以及如何在导入和导出配置文件。
- 三问 数据采集之三 如何顺利导入数据
- 敏捷个人A2组第二次练习 如何能够顺利完成目标?
- 如何将Maven项目顺利的导入到MyEclipse中
- 【Studio】Android Studio如何最快速、顺利导入其他项目
- 【Studio】Android Studio如何最快速、顺利导入其他项目
- 关于Arcgis数据导入mdb完成后如何立刻解除mdb的锁定
- 如何顺利完成从员工到管理者的角色转变?
- 敏捷个人A2组第二次讨论 如何能够顺利完成目标? 推荐
- [导入]如何完成.Net下XML文档的读写操作
- 如何把数据导入不同的表空间?
- 如何完成一款游戏? | 独立游戏制作
- 如何把MyEclipse中的web项目导入到Eclipse中运行
- 如何使用PLSQL Developer从oracle数据库导入导出数据
- Xcode 如何导入静态开源库
- eclipse 如何批量导入project
- Laravel 4 入门三讲(中)laravel 的路由是如何完成注册的?
- 如何用AndroidStudio导入github项目
- Eclipse下如何导入jar包
- eclipse如何导入okhttp 2.x源码