Comparing two postgres dump files

馋奶兔 提交于 2020-01-02 01:15:27

问题


How to compare postgres dump files? I have two dump files, dump1 and dump2 . And I want to compare these two dump files.

Any help will be appreciated..

Thank you


回答1:


PostgreSql's dump files are like normal data files.. you can use any utility/tool to see the difference between them.. Most of the OS has build in utilities for this

For example:

  • linux:

vimdiff dump1 dump2 (http://alvinalexander.com/linux-unix/vimdiff-see-multiple-file-differences-visually)

  • On Windows:

fc dump1 dump2 (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fc.mspx?mfr=true)




回答2:


You can use beyond compare if windows is been used and use kompare if linux(fedora) is been used also if linux is used than you can use different command like sdiff example is provided in this link, other commands are diff,comm -23 filedump1 fuledump2,sort filedump1 > filedump1.sorted sort fuledump2 > fuledump2.sorted diff filedump1.sorted fuledump2.sorted etc are utilities to compare text in files




回答3:


You could try a simple textual comparison, to start with (diff command or similar tools).

If you need more than that, there are tools that make database comparisons. For example:

This one compares dumps - but only the schema (not the data).

This one compares data in tables (not from dumps, but from live databases).

Disclaimer: I have not tried them.




回答4:


I would use WinMerge to compare the schema dumps. Data dumps will not be sorted (I just opened a bug report about this), but there are better tools to do that.



来源:https://stackoverflow.com/questions/5713938/comparing-two-postgres-dump-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!