database Oracle 数据泵导出/导入

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

Oracle Datapump export/import

databaseoracleoracle10g

提问by user1263981

I am trying to copy data b/w two databases and both sit on different servers. Both are Oracle 10g.

我正在尝试将数据黑白复制两个数据库,并且都位于不同的服务器上。两者都是 Oracle 10g。

On my pc, i am connected to live database through Toad and there is 10g client installed on my pc.

在我的电脑上,我通过 Toad 连接到实时数据库,并且我的电脑上安装了 10g 客户端。

Through Toad i am trying to export data dump file but on my pc i can't find expdp.exe file, i think this component is not installed on my pc.

通过 Toad 我试图导出数据转储文件,但在我的电脑上我找不到 expdp.exe 文件,我认为我的电脑上没有安装这个组件。

How can i install expdp.exe on my pc?

Can i export data dump files on my pc(network) and not on server?

By default, dump files are copied on server, but can i copy and paste them on my pc and then use those file to import data on different server through Toad.

如何在我的电脑上安装 expdp.exe?

我可以在我的电脑(网络)而不是服务器上导出数据转储文件吗?

默认情况下,转储文件被复制到服务器上,但我可以将它们复制并粘贴到我的电脑上,然后使用这些文件通过 Toad 导入不同服务器上的数据。

采纳答案by Olaf

The files for the Oracle datapump export/import can only reside on the same server as the Oracle database. If Oracle client was installed on your PC, you should have expdp/impdp utilities. Just make sure you call them from command line, not from Toad.

Oracle 数据泵导出/导入的文件只能与 Oracle 数据库驻留在同一服务器上。如果您的 PC 上安装了 Oracle 客户端,则您应该拥有 expdp/impdp 实用程序。只要确保您从命令行调用它们,而不是从 Toad 调用。

So, to summarize. To transfer data from one Oracle server to another:

所以,总结一下。要将数据从一台 Oracle 服务器传输到另一台:

  • run expdp from your PC
  • copy the dump file from the server to your PC; it might be wise to also grab the generated log file while you are at it
  • copy the dump file from your PC to another server
  • run impdp from your PC
  • 从您的 PC 运行 expdp
  • 将转储文件从服务器复制到您的 PC;在您使用生成的日志文件时也获取它可能是明智的
  • 将转储文件从您的 PC 复制到另一台服务器
  • 从您的 PC 运行 impdp

回答by kevinsky

The data pump utility will move schemas and data between two databases with less work than importing and exporting dump files. Oracle recommends it as the successor to imp and exp.

数据泵实用程序将在两个数据库之间移动模式和数据,而工作量比导入和导出转储文件要少。Oracle 推荐它作为imp 和exp 的继任者。

  • Verify that the directory DATA_PUMP_DIR exists or create it.
  • Use or create a user on the destination database who has read and write on that directory and DBA privilege
  • verify or create a database link from destination to the source
  • on the destination database drop the users whose schema and data you wish to recreate
  • on the destination database run a script like this

    SET NLS_LANG= your language

    SET ORACLE_SID = your database name

    impdp import_user/destination_database_name directory=DATA_PUMP_DIR network_link=link_name schemas= user1,user2 LOGFILE=Import.log TABLE_EXISTS_ACTION=REPLACE

  • 验证目录 DATA_PUMP_DIR 是否存在或创建它。
  • 在目标数据库上使用或创建对该目录具有读写权限和 DBA 权限的用户
  • 验证或创建从目标到源的数据库链接
  • 在目标数据库上删除您希望重新创建其架构和数据的用户
  • 在目标数据库上运行这样的脚本

    SET NLS_LANG= 你的语言

    SET ORACLE_SID = 您的数据库名称

    impdp import_user/destination_database_name directory=DATA_PUMP_DIR network_link=link_name schemas= user1,user2 LOGFILE=Import.log TABLE_EXISTS_ACTION=REPLACE

This is windows syntax and will differ for Linux. Substitute your database names, schemas and link names.

这是 Windows 语法,对于 Linux 会有所不同。替换您的数据库名称、模式和链接名称。

回答by a_horse_with_no_name

As other have already mentioned you DataPump cannot use files outside of the database server.

正如其他人已经提到的,您 DataPump 不能使用数据库服务器之外的文件。

You don't need the expdp and impdp utilities installed locally however. You can start DataPump jobs through SQL by using the DBMS_DATAPUMP package.

但是,您不需要在本地安装 expdp 和 impdp 实用程序。您可以使用 DBMS_DATAPUMP 包通过 SQL 启动 DataPump 作业。

http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_datpmp.htm

http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_datpmp.htm

Here are some examples on how to use the package:

以下是有关如何使用该软件包的一些示例:

回答by Trogdor

For the cases shown here, the only difference between imp/exp and impdp/expdp is where the .dmp file ends up. If you use exp from your PC, then the file will be on your PC and you don't have to move it from the Oracle server. In our shop only the DBAs have access to the server, so exp is what I use.

对于此处显示的情况,imp/exp 和 impdp/expdp 之间的唯一区别是 .dmp 文件的最终位置。如果您在 PC 上使用 exp,那么该文件将在您的 PC 上,您不必从 Oracle 服务器中移动它。在我们店里,只有 DBA 可以访问服务器,所以我使用的是 exp。