oracle 如何在oracle中的同一数据库上创建完整模式的副本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26785645/
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-09 00:39:47  来源:igfitidea点击:

How to create copy of full schema on same database in oracle

oracleoracle11goracle10gdatabase-administration

提问by user3209595

I want to create full copy of the schema on the same database. What is the best technique to do that?

我想在同一个数据库上创建模式的完整副本。做到这一点的最佳技术是什么?

I have few ideas in mind:

我有几个想法:

  1. Datapump Over Db link
  2. IMPDP on network link
  3. EXPDP and then IMPDP.
  1. 数据库链接上的数据泵
  2. 网络链路上的 IMPDP
  3. EXPDP 然后是 IMPDP。

What would be the advantages and/or drawbacks of each technique?

每种技术的优点和/或缺点是什么?

回答by mmmmmpie

You don't need a fancy network link or anything just the expdp/impdp commands. First export the schema that you want:

您不需要花哨的网络链接或任何仅 expdp/impdp 命令。首先导出您想要的架构:

expdp fromUser/fromPword schemas=sourceSchema directory=DUMPDIR dumpfile=dump.dmp logfile=explog.txt

Tip: make sure that that user has the ability to write to DUMPDIR or whatever it is you call it

提示:确保该用户能够写入 DUMPDIR 或您称之为的任何内容

Then reimport the schema using the remap_schemaparameter:

然后使用remap_schema参数重新导入架构:

impdp toUser/toPword directory=DUMPDIR dumpfile=dump.dmp logfile=implog.txt remap_schema=fromUser:toUser

If you really want to use the network_link parameter (so you don't create a dumpfile for some reason) then I recommend reading thisor this.
Great info on your question is found herealso.

如果您真的想使用 network_link 参数(因此您不会出于某种原因创建转储文件),那么我建议您阅读.
这里也可以找到有关您问题的重要信息。

回答by Rooie3000

Try this:

尝试这个:

Copy schema into same database

将模式复制到同一数据库中

I tested and it worked. but you have to create a public link like mentioned in the comments.

我测试过,它奏效了。但你必须创建一个像评论中提到的公共链接。

If you create a .par file which remaps your tablespaces you can reuse it. With some search replace of course.

如果您创建一个重新映射表空间的 .par 文件,您可以重用它。当然,通过一些搜索替换。

O and don't forget to put the transaform in the .par file:

O 并且不要忘记将 transaform 放在 .par 文件中:

TRANSFORM=oid:n

Otherwise you might get errors.

否则你可能会得到错误。