oracle 如何将数据从一个数据库复制到不同服务器上的另一个数据库?

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

How copy data from one database to another on different server?

databaseoracletestingbackupsqlplus

提问by Bohdan

I have 2 DB with the same schema on different servers. I need to copy data from table T to the same table T in test database in different server and network.

我在不同的服务器上有 2 个具有相同架构的数据库。我需要将数据从表 T 复制到不同服务器和网络的测试数据库中的同一个表 T。

What is the easiest way to do it? I heard that data can be dumped to flat file and than inserted into database. How does it works? Can this be achieved using sqlplus and oracle database?

最简单的方法是什么?我听说数据可以转储到平面文件,然后插入到数据库中。它是如何工作的?这可以使用sqlplus和oracle数据库来实现吗?

Thank you!

谢谢!

回答by jim mcnamara

Use Oracle export to export a whole table to a file, copy the file to serverB and import.

使用Oracle export 将整个表导出到一个文件,将文件复制到serverB 并导入。

http://www.orafaq.com/wiki/Import_Export_FAQ

You can use rsync to sync an oracle .dbf file or files to another server. This has problems and syncing all files works more reliably.

您可以使用 rsync 将一个或多个 oracle .dbf 文件同步到另一台服务器。这有问题,同步所有文件的工作更可靠。

For groups of records, write a query to build a pipe-delimited (or whatever delimiter suits your data) file with rows you need to move. Copy that file to serverB. Write a control file for sqlldr and use sqlldr to load the rows into the table. sqlldr is part of the oracle installation.

对于记录组,编写一个查询来构建一个管道分隔(或任何适合您的数据的分隔符)文件,其中包含您需要移动的行。将该文件复制到 serverB。为 sqlldr 编写一个控制文件并使用 sqlldr 将行加载到表中。sqlldr 是 oracle 安装的一部分。

http://www.thegeekstuff.com/2012/06/oracle-sqlldr/

If you have db listeners up on each server and tnsnames knows about both, you can directly:

如果您在每个服务器上都有 db 侦听器并且 tnsnames 知道两者,您可以直接:

insert into mytable@remote 
select * from mytable
  where somecolumn=somevalue;

Look at the remote table section:

查看远程表部分:

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9014.htm

If this is going to be an ongoing thing, create a db link from instance@serverA to instance@serverB. You can then do anything you have permissions for with data on one instance or the other or both.

如果这将是一个持续的事情,请创建一个从 instance@serverA 到 instance@serverB 的数据库链接。然后,您可以对一个或另一个或两者上的数据执行您有权执行的任何操作。

http://psoug.org/definition/CREATE_DATABASE_LINK.htm