从oracle迁移到MySQL期间如何使用Java比较两者之间的数据
我已使用 MySQL Migration Toolkit 作为 POC 将数据从 Oracle 迁移到 MySQL。现在我想用Java比较不同数据库的相同表之间的数据。
我已经完成了两个数据库中表的简单总行数。但我想检查两个表的每一行,以便可以计算出任何 Oracle 表发布或迁移期间的任何更新。
I have migrated data from Oracle to MySQL using MySQL Migration Toolkit as POC. Now I want to compare data between same tables of different databases with Java.
I have done the simple total no of rows of the tables in two database. But I want to check each and every row of two tables so that any update in any oracle table post or during migration can be figured .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能听起来有点傻,但是一个只读取两个数据库并比较数据的简单程序怎么样?
您可以编写一个包含一行中所有数据的类,重写 equals() 和 hashCode(),然后读取两个表并使用创建的类对它们进行比较。
然后在您的程序中:
当然,如果行数很大并且内存使用量是一个问题,您可能需要考虑一次一行读取表。
This might sound a bit silly, but how about a simple program which just reads both databases and compares the data?
You could write a class containing all the data from one row, override equals() and hashCode(), then read both tables and compare them using the created class.
Then in your program:
Of course, you might want to consider reading the tables a row at a time, if the amount of rows is massive and memory usage is an issue.