简体   繁体   English

如何将数据从Oracle中的(PL /)SQL复制到另一个DBMS?

[英]How to copy data from (PL/)SQL in Oracle to another DBMS?

Task : copy all data in a database (without schema) to another database (possibly of a different type). 任务 :将数据库中的所有数据(无模式)复制到另一个数据库(可能是不同类型)。 I can't modify source database, so it is a read-only backup 我无法修改源数据库,因此它是只读备份

Context : integrate Oracle with a number of DBs. 上下文 :将Oracle与许多数据库集成。 Now I'm integrating Oracle and Postgres. 现在我正在整合Oracle和Postgres。

Resources : connection string only, with ability to connect database with highest available privileges. 资源 :仅限连接字符串,能够以最高可用权限连接数据库。 (I can't access it via ssh - no way to create ordinal backup and download files via ssh, or to compile and start web/ftp server, etc.) (我无法通过ssh访问它 - 无法通过ssh创建顺序备份和下载文件,或者编译和启动web / ftp服务器等)

Question : Is there any proven and FAST way to pull this data? 问题 :是否有任何经过验证的快速方法来提取这些数据? Maybe someone has an open source solution with clean code? 也许某人有一个干净的代码的开源解决方案?

The word "fast" is present here because just selecting N rows in a turn (using rownum or row_number()) and transfering to a target database or intermediate file is too slow. 这里出现“fast”这个词,因为只需在一个回合中选择N行(使用rownum或row_number())并转移到目标数据库或中间文件太慢。

I suggest you take a look at Liquibase . 我建议你看看Liquibase I have used it successfully to keep both schemas and data aligned across several environments (albeit only SQLServers, but I'm certain it works for disparate RDBMS' as well). 我成功地使用它来保持模式和数据在多个环境中保持一致(尽管只有SQLServers,但我确信它也适用于不同的RDBMS)。

As for the performance I am a bit worried, as you mention "terabytes of data"... Still, it might be worth a try. 至于性能我有点担心,因为你提到“太字节数据”......不过,它可能值得一试。

Cheers, 干杯,

A light-weight ETL tool like spring-batch might be the perfect tool for this task. 像弹簧批这样的轻量级ETL工具可能是完成此任务的完美工具。

Micromanagement of data chunks is what it is written around. 数据块的微观管理就是它的编写方式。

Take a look at the jdbc cursor example: you just configure the SELECT and INSERT statement, and the mapping, and Spring-Batch will take care of the pagination. 看一下jdbc游标示例:您只需配置SELECT和INSERT语句,以及映射,Spring-Batch将处理分页。

You can find it in github: https://github.com/SpringSource/spring-batch/blob/master/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml 你可以在github找到它: https//github.com/SpringSource/spring-batch/blob/master/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml

Reference can be found at: http://static.springsource.org/spring-batch/reference/html/readersAndWriters.html#database 参考资料可在以下网址找到: http//static.springsource.org/spring-batch/reference/html/readersAndWriters.html#database

Spring batch keeps state of how many records already have been processed, and allows to continue a previously crashed process. Spring批处理保持已经处理了多少记录的状态,并允许继续先前崩溃的进程。 It does this by saving counters in a 'jobRepository', which can be in a third database, for example. 它通过将计数器保存在'jobRepository'中来实现,例如,它可以在第三个数据库中。

Of course, this is a pure java solution, a native solution may be faster, but if you only get JDBC connection strings, you might give this a shot. 当然,这是一个纯java解决方案,本机解决方案可能更快,但如果你只获得JDBC连接字符串,你可能会给这一点。 This also assumes you know the table structure of all tables you want to transfer. 这也假设您知道要传输的所有表的表结构。 If not, simple JDBC tools like eg SquirrelSQL can help you. 如果没有,像SquirrelSQL这样的简单JDBC工具可以帮到你。

Greets, Geert. Greets,Geert。

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

相关问题 如何将选择性数据从一个数据库复制到另一个数据库(ORACLE) - How to copy selective data from one database to another (ORACLE) 如何使用参数从Oracle PL / SQL执行Java jar文件? - How execute a Java jar file from Oracle PL/SQL with parameters? 如何使用 JDBC 的 Oracle DBMS 的 COPY 表命令? - How to use COPY table command of Oracle DBMS using JDBC? 如何将Map传递给Oracle PL / SQL函数? - How to pass Map to Oracle PL/SQL function? 如何以良好的性能将大量数据从一个Oracle数据库复制到另一个数据库 - How to copy huge amount of data from one Oracle database to another with good performance 如何将数据从一个数据库复制到另一个Oracle数据库? - How can I copy data from one DB to another oracle DB? Oracle PL / SQL-其他团队调用的过程,用于插入数据。 正在从Java调用过程 - Oracle PL/SQL - a procedure called by some other team to insert data. Procedure is being called from Java 如何从Java调用oracle dbms_scheduler.run_job? - How to call oracle dbms_scheduler.run_job from java? How to correctly develop, upload java library with dependencies to Oracle DB and call my Java function from PL\SQL? - How to correctly develop, upload java library with dependencies to Oracle DB and call my Java function from PL\SQL? Oracle PL / SQL存储过程中的JDBC结果集 - JDBC result set from an Oracle PL/SQL stored procedure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM