如何将数据从一个数据库复制到另一个在不同的服务器上? [英] How copy data from one database to another on different server?

查看:264
本文介绍了如何将数据从一个数据库复制到另一个在不同的服务器上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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?

谢谢!

推荐答案

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

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

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

您可以使用rsync同步oracle .dbf文件或文件到另一个服务器。

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.

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

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.

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

如果您在每个服务器上启用了db侦听器,并且tnsnames知道这两者,您可以直接: p>

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

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

查看远程表部分:

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

如果这将是一个正在进行的事情,请创建一个从instance @ serverA到instance @ serverB的数据库链接。
然后,您可以对一个实例或其他实例上的数据执行任何您具有权限的操作。

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.

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

这篇关于如何将数据从一个数据库复制到另一个在不同的服务器上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆