开发者

Compare two tables and save the difference in a file

I have two tables in two different Oracle databases, they look the same (same column names etc) but the data is mostly different. I would like to compare them and save the difference in a third database (or just save it in an easily imported format).

The tables aren't huge but its still like 40 million rows in each table and would like help to d开发者_开发问答o the compare in an efficient way.

There is no keys or unique columns but there are no columns with the same Nr and Name

Table:

 Nr    Name    AText
 1234  Jon Doe Ksjfkjsdkfjksdfsf
 3234  Jon Sho sdfsdfasdfsdf
 1434  Ian Doe lksjdfkljlkjsdfkj


If you're not trying to do this programmatically, you should take a look at SQL Data Compare from Red Gate. I believe it does exactly what you're looking for.


Depends on what you want to find. For example, if tables are very simmilar, you can make two exports to txt files but ordered(select * from table order by 1, 2, 3) and then try a diff -h between these files. This is somehow fast.

Or, you can import one table in the other database, and try minus, but this is slow. Advantage: you can minus (col1, col2) and exclude col3...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜