今天同事说申请了一个从生产导出的dump文件,须要导入測试库进行測试。
之前做的基本都是本库导出,本库导入的操作,比如:imp test/***@test tables=tbl_fuel file=H:\dev\data\tbl_fuel.dmp ignore=y这种指令操作。
今天的情况是从一个库的用户导出dump。然后导入到另外一个库的用户中。

导出:
exp p_x/**  FILE=tables.dmp TABLES=e.pre_ldp,e.tbl_flight log=tables.log rows=y

几种错误的导入:
imp test/***@test tables=(tbl_a,tbl_b) file=tables.dmp log=test.log full=y
提示:
IMP-00024: Only one mode (TABLES, FROMUSER, or FULL) can be specified
TABLES、FROMUSER和FULL參数仅仅能使用一个。

imp test/***@test file=tables.dmp log=test.log ignore=n
提示:
Warning: the objects were exported by P_X, not by you

import done in ZHS16CGB231280 character set and AL16UTF16 NCHAR character set

import server uses ZHS16GBK character set (possible charset conversion)

export client uses ZHS16GBK character set (possible charset conversion)

export server uses UTF8 NCHAR character set (possible ncharset conversion)

IMP-00031: Must specify FULL=Y or provide FROMUSER/TOUSER or TABLES arguments

IMP-00000: Import terminated unsuccessfully
FULL=Y、FROMUSER/TOUSER和TABLES參数必须指定当中之中的一个。

imp test/***@test file=tables.dmp
log=test.log ignore=n fromuser=user ouser=test

提示:

Warning: the objects were exported by P_X, not by you

import done in ZHS16CGB231280 character set and AL16UTF16 NCHAR character set

import server uses ZHS16GBK character set (possible charset conversion)

export client uses ZHS16GBK character set (possible charset conversion)

export server uses UTF8 NCHAR character set (possible ncharset conversion)

IMP-00034: Warning: FromUser "USER" not found in export file

Import terminated successfully with warnings.
说明From User "USER"不包括在dump文件里。但通过这样的方式能够找到是哪个用户使用exp导出的这份dump文件。


imp test/***@test file=tables.dmp log=test.log ignore=n tables=tbl_a
提示:
Warning: the objects were exported by P_X, not by you

import done in ZHS16CGB231280 character set and AL16UTF16 NCHAR character set

import server uses ZHS16GBK character set (possible charset conversion)

export client uses ZHS16GBK character set (possible charset conversion)

export server uses UTF8 NCHAR character set (possible ncharset conversion)

. importing P_X's objects into TEST

IMP-00033: Warning: Table "TBL_A" not found in export file
说明TBL_A表并不在导出的dump中,个人觉得,由于这里未使用FROMUSER这些參数,默认就是dump中包括的数据是从本地test用户的,因此这会报错。



imp test/***@test file=tables.dmp
log=test.log ignore=n fromuser=e touser=test(未建立表结构)
imp test/***@test file=tables.dmp log=test.log
ignore=y fromuser=e touser=test(已建立表结构)
这里表示删除了表后,ignore=n。dump的来源是e这个schema或用户,导入到这个測试test用户下。


当然。因为test用户没有导出库的一些角色,因此例如以下这些权限操作可能会失败,但不影响使用这些測试。

IMP-00017: following statement failed with ORACLE error 1917:

 "GRANT UPDATE ON "TBL_A" TO "B_E""

參数:
fromuser详细指定那个用户下的对象须要导入,所以假设这里使用p_x。会报错。由于表不在p_x用户下。
touser详细指定导入那个用户。该參数必须跟fromuser一起使用。

show在屏幕显示文件内容。详细不会做导入操作。
ignore忽略导入过程中创建对象的错误(确保数据可以导入),但不会忽略写入数据的错误(如导入的数据跟当前表里的数据有违反唯一性约束的错误)。
commit该參数为Y时。导入的过程会提交数据行,若buffer设置得太小。则会过去频繁的提交数据,对性能有一定的影响。使用commit另一个优点。就是做測试数据导入时。假设有些错误未插入数据库,使用commit后会将符合的记录commit提交,不会导致整个导入操作回滚,由于毕竟是做測试。多一些少一些数据问题不是非常大。
full导入整个文件。
tables导入表名列表,多个表名,逗号分隔。

rows该參数为Y的时候将导入数据,默认是导入数据。但出于某种原因能够将该參数设置成N即不导入数据行。

最新文章

  1. Java期末设计(十三周)
  2. vue组件的配置属性
  3. hdu 4036 2011成都赛区网络赛F 模拟 **
  4. SQL Server 2008下日志清理方法
  5. 使用Unity游戏引擎在IOS模拟器中运行的方法
  6. Linux的用户和用户组管理
  7. ASP 代码当前记录集不支持更新问题的解决办法。
  8. Knockout中ko.utils中处理数组的方法集合
  9. Sudoku POJ - 3076 (dfs+剪枝)
  10. 解决The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
  11. (1)什么是web框架和http协议
  12. 超细讲解Django打造大型企业官网
  13. RAISR: rapid and accurate image super resolution
  14. iphone splash screen
  15. UVA1583(最小生成元)
  16. 练习calico的网络policy
  17. 无线遥控检测仪 A890-RES
  18. 爬虫用到的库Beautiful Soup
  19. Spark --【宽依赖和窄依赖】
  20. lapis 集成openresty最新版本cjson 问题的解决

热门文章

  1. 根据点画线java
  2. JAVA MessageDigest(MD5加密等)
  3. Flask项目之手机端租房网站的实战开发(十四)
  4. 洛谷 P2384 最短路
  5. [bzoj1269]文本编辑器editor [bzoj1500]维修数列
  6. bootstrap课程7 jquery中结束之前动画用什么
  7. Android内存泄露分析之StrictMode
  8. ASP.NET MVC案例教程(基于ASP.NET MVC beta)——第二篇:第一个页面
  9. Linux体系结构
  10. 学习笔记:Vue——处理边界情况