使用 expdp 和 impdp 迁移 Oracle 数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7528106/
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
Migrating Oracle Database with expdp and impdp
提问by Christian Ammer
Does the target database need to be prepared with tablespace and/or user (schema) in order to successfully migrate a schema from one database (11g R1) to another (11g R2)?
目标数据库是否需要准备表空间和/或用户(架构)才能成功地将架构从一个数据库 (11g R1) 迁移到另一个 (11g R2)?
Currently I only can make tests with the 11g R1 database. My test was to export a schema and import it into a new schema within the same database.
目前我只能使用 11g R1 数据库进行测试。我的测试是导出模式并将其导入同一数据库中的新模式。
expdp system/systempass schemas=oldschema
After that I tried to import it with:
之后,我尝试将其导入:
impdp system/systempass expdat.dmp remap_schema=oldschema:newschema
But this leads to the error:
但这会导致错误:
UDI-00014: invalid value for parameter, 'attach'
- Does this error tell me that
newschema
is not defined? - Do I have to create a new user?
- Do I have to create a tablespace for such a new user?
- 此错误是否告诉我
newschema
未定义? - 我必须创建一个新用户吗?
- 我是否必须为这样的新用户创建表空间?
The questions also relate to a new installed 11g R2 database on a new PC. Any suggestions migrating a database to a fresh installed database are welcome!
这些问题还与新 PC 上新安装的 11g R2 数据库有关。欢迎任何将数据库迁移到新安装的数据库的建议!
回答by cagcowboy
"Does the target database need to be prepared with tablespace and/or user (schema) in order to successfully migrate a schema from one database (11g R1) to another (11g R2)?"
“目标数据库是否需要准备表空间和/或用户(架构)才能成功地将架构从一个数据库 (11g R1) 迁移到另一个 (11g R2)?”
Tablespaces - yes. Users - no.
表空间 - 是的。用户 - 没有。
UDI-00014: invalid value for parameter, 'attach'
I think the order of parameters is incorrect when calling impdp. Should be of the form:
我认为调用impdp时参数的顺序不正确。应该是以下形式:
impdp username/password DUMPFILE=<filename> [and then whatever other parameters you need for your import]
Since you're doing a "migration" I assume it's a full imp/exp, in which case you probably want:
由于您正在进行“迁移”,因此我认为它是完整的 imp/exp,在这种情况下,您可能需要:
impdp username/password DUMPFILE=<filename> FULL=Y
With regard to your current test within the same db, I suggest you check-out:
关于您在同一数据库中的当前测试,我建议您查看:
http://psoug.org/reference/datapump.html
http://psoug.org/reference/datapump.html
for a couple of examples
举几个例子
回答by sergeyan
I asume that a lot of people came here for: 'UDI-00014: invalid value for parameter' error like me. For those my situation was the following.
我假设很多人来到这里是为了:' UDI-00014: invalid value for parameter' 像我一样的错误。对于那些我的情况如下。
I had a different scenario and for me it was complaining on 'remap_schema' parameter. It appeared that I need to add double quotes to values like the following:
我有一个不同的场景,对我来说它抱怨'remap_schema'参数。看来我需要为如下值添加双引号:
Before(failed)
之前(失败)
impdp user/password directory=dump_dir dumpfile=myfile.dmp remap_schema=my_schema:my_schema remap_tablespace=my_schema:my_schema logfile=mylog.log
impdp 用户/密码目录=dump_dir dumpfile=myfile.dmp remap_schema=my_schema:my_schema remap_tablespace=my_schema:my_schema logfile=mylog.log
After(worked)
之后(工作)
impdp user/password directory=dump_dir dumpfile=myfile.dmp remap_schema="my_schema":"my_schema" remap_tablespace="my_schema":"my_schema" logfile=mylog.log
impdp 用户/密码目录=dump_dir dumpfile=myfile.dmp remap_schema="my_schema":"my_schema" remap_tablespace="my_schema":"my_schema" logfile=mylog.log
回答by Greg Parrish
If you are not using the ATTACH parameter during the import then open a new command line window and run the import and it should now work. For me the environment variables are the same, but some how this is now working.
如果您在导入过程中没有使用 ATTACH 参数,则打开一个新的命令行窗口并运行导入,它现在应该可以工作了。对我来说,环境变量是相同的,但现在是如何工作的。