整个数据库导出导入
来源:互联网 发布:mac地址冲突的概率 编辑:程序博客网 时间:2024/06/04 18:12
方法一:
可以使用exp导出所有东西,exp中的参数full=y即可
exp username/password@sid file=d:\exp.dmp full=y
如果要导入整个数据库
imp username/password@sid file=d:\exp.dmp full=y ignore=y
问题:昨天试了这种方法不行。问题如下图。
分析原因一:存在Link,先删除Link,导入进去再加上就行。
分析原因二:
分析原因三:违反约束性导致的。
当做 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
方法二:这种方法不行的时候,只导出系统用到的某个用户的数据就可以,可能是因为这些数据不存在上述问题。
exp system/manager@TEST file=d:\daochu.dmp owner=(csr)
imp username/password@sid file=d:\exp.dmp full=y ignore=y
- 整个数据库导出导入
- mysql导出整个数据库
- 导出整个数据库
- Oracle导出整个数据库
- mysql 导入导出整个库
- sql server导入整个数据库
- MySQL数据库中导出整个数据库
- MySQL数据库中导出整个数据库:
- mysql导入导出sql文件 window下 1.导出整个数据库 mysqldump -u 用户名 -p 数据库名 > 导出的文件名 mysqldump -u dbuser -p dbname >
- 导出导入oracle数据库
- 数据库导入导出
- 数据库的导入导出
- 数据库导入导出收藏
- Mysql数据库导入导出
- 数据库的导出导入
- 数据库的导出导入
- 数据库导入导出Excel
- Oracle数据库导入导出
- 【八月英语----照亮我心】
- 判断本地存储模式为大段还是小端
- CentOS6.5下安装scala
- Java开源任务调度器Quartz的应用案例
- 授权与分工、助理、代理的区别
- 整个数据库导出导入
- 第10课 绘图控制
- 【挖坑记】JZOJ 4738 神在夏至祭降下了神谕
- Android隐藏的权限管理机制:AppOps
- Android笔记之获取IP、掩码、网关的有效方式
- Eclipse的使用
- 第11课 图形的保存和重绘
- spark-RDD
- 任务寄存器(Task Register)