从一个数据库(HANA)传输表到另一个数据库(MySQL)。

huangapple go评论67阅读模式
英文:

Transfer tables from one DB (HANA) to another DB (MySQL

问题

我需要一些建议。我需要将大约1000个表从Hana数据库转移到一个MySQL数据库中。在MySQL数据库中将创建与Hana数据库中相同的表。我需要使用Java创建一些东西来完成以下任务:首先,我需要读取整个数据库并检索有关所有表的信息(表名、列名和列类型),以便与MySQL数据库的信息进行比较。接下来的步骤是将表内容从第一个数据库传输到第二个数据库。请给予一些建议,谢谢。

英文:

I need a bit of advice. I need to transfer tables (approx. 1000) from DB Hana to one MySql DB. In MySql DB will be creating the same tables as in Hana DB. I need to create something using Java what need to do these things: First of all, I need to read all database and retrieve information about all tables (table name, columns name, and columns types) to compare with the MySql DB info. The next step is to transfer table content from the first DB to the second DB. Some advice, please?

答案1

得分: 1

根据我的经验,我建议在两个数据库之间使用一个跟踪表来执行迁移。您可以在其中一个数据库上创建一个专用架构,然后将需要从一个数据库迁移到另一个数据库的所有内容保存在那里,并逐步将所有内容标记为“已完成”。

另外,您还可以将需要从 Hana 迁移的所有内容导出为一个 SQL 脚本,然后通过编程将该脚本转换为与 MySQL 兼容的语法,并执行更新操作。

第一种方法稍微麻烦一些,但可以更好地控制迁移过程。第二种方法在某种程度上较为简单,因为您只需要翻译并执行生成的脚本,但如果由于某种原因过程中断,要从中断的地方恢复则会较为困难。

英文:

From my experience, I suggest using a tracking table in the middle of the two DBs to perform the migration. You can create a dedicated schema on one of the two DBs and then save there everything you need to migrate from a DB to another and progressively mark everything as "done".

Alternatively, you can export everything you need to migrate from Hana as an SQL script and then programmatically translate the script to a MySQL compatible syntax and execute updates.

The first approach is a little bit more cumbersome but grants you more control over the migration process. The second one is kind of easier since you just need to translate and execute the generated script, but it's harder, if the process stops for whatever reason, to resume from where you stopped.

huangapple
  • 本文由 发表于 2020年9月2日 21:19:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/63706434.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定