前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >用户之间imp的问题

用户之间imp的问题

作者头像
bisal
发布2019-01-29 14:44:04
8720
发布2019-01-29 14:44:04
举报

今天同事说申请了一个从生产导出的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即不导入数据行。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2014年04月30日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档