简体   繁体   English

Oracle 数据泵导出/导入

[英]Oracle Datapump export/import

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?如何在我的电脑上安装 expdp.exe?

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

The files for the Oracle datapump export/import can only reside on the same server as the Oracle database. Oracle 数据泵导出/导入的文件只能与 Oracle 数据库驻留在同一服务器上。 If Oracle client was installed on your PC, you should have expdp/impdp utilities.如果您的 PC 上安装了 Oracle 客户端,则您应该拥有 expdp/impdp 实用程序。 Just make sure you call them from command line, not from Toad.只需确保您从命令行调用它们,而不是从 Toad 调用。

So, to summarize.所以,总结一下。 To transfer data from one Oracle server to another:要将数据从一台 Oracle 服务器传输到另一台:

  • run expdp from your PC从您的 PC 运行 expdp
  • copy the dump file from the server to your PC;将转储文件从服务器复制到您的 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将转储文件从您的 PC 复制到另一台服务器
  • run impdp from your PC从您的 PC 运行 impdp

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.但是,您不需要在本地安装 expdp 和 impdp 实用程序。 You can start DataPump jobs through SQL by using the DBMS_DATAPUMP package您可以使用DBMS_DATAPUMP 包通过 SQL 启动 DataPump 作业

Here are some examples on how to use the package:以下是有关如何使用该软件包的一些示例:

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.验证目录 DATA_PUMP_DIR 是否存在或创建它。
  • Use or create a user on the destination database who has read and write on that directory and DBA privilege在目标数据库上使用或创建对该目录具有读写权限和 DBA 权限的用户
  • 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 NLS_LANG= 你的语言

    SET ORACLE_SID = your database name 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 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.这是 Windows 语法,对于 Linux 会有所不同。 Substitute your database names, schemas and link names.替换您的数据库名称、模式和链接名称。

For the cases shown here, the only difference between imp/exp and impdp/expdp is where the .dmp file ends up.对于此处显示的情况,imp/exp 和 impdp/expdp 之间的唯一区别是 .dmp 文件的最终位置。 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.如果您在 PC 上使用 exp,那么该文件将在您的 PC 上,您不必从 Oracle 服务器中移动它。 In our shop only the DBAs have access to the server, so exp is what I use.在我们店里,只有 DBA 可以访问服务器,所以我使用的是 exp。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM