将一个模式导入另一个新模式 - Oracle

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15142798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:53:13  来源:igfitidea点击:

Import one schema into another new schema - Oracle

oracle

提问by Ram

I have a data dmp file exported from one schema user1 using the expcommandline utility.

我有一个使用exp命令行实用程序从一个架构 user1 导出的数据 dmp 文件。

I want to import this dump onto another newly created (empty) schema user 2 using the impcommandline utility.

我想使用imp命令行实用程序将此转储导入另一个新创建的(空)架构用户 2 。

I tried a few things like:

我尝试了一些事情,例如:

imp system/password@tesdb fromuser=user1 touser=user2 file=E:\Data\user1.dmp log=E:\Data\user1.log

I get an error

我收到一个错误

IMP-00002: failed to open user1.dmp for read
Import file: EXPDAT.DMP >

Any help appreciated.

任何帮助表示赞赏。

采纳答案by Ram

The issue was with the dmp file itself. I had to re-export the file and the command works fine. Thank you @Justin Cave

问题出在 dmp 文件本身。我不得不重新导出文件,命令工作正常。谢谢@Justin Cave

回答by Adam

After you correct the possible dmp file problem, this is a way to ensure that the schema is remapped and imported appropriately. This will also ensure that the tablespace will change also, if needed:

在您更正可能的 dmp 文件问题后,这是一种确保架构被正确地重新映射和导入的方法。如果需要,这也将确保表空间也会更改:

impdp system/<password> SCHEMAS=user1 remap_schema=user1:user2 \
            remap_tablespace=user1:user2 directory=EXPORTDIR \
            dumpfile=user1.dmp logfile=E:\Data\user1.log

EXPORTDIR must be defined in oracle as a directory as the system user

EXPORTDIR 必须以系统用户身份在oracle中定义为目录

create or replace directory EXPORTDIR as 'E:\Data';
grant read, write on directory EXPORTDIR to user2;