比较两个 postgres 转储文件
如何比较 postgres 转储文件? 我有两个转储文件 dump1 和 dump2 。我想比较这两个转储文件。
任何帮助将不胜感激..
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果使用 Windows,则可以使用 Beyond Compare;如果使用 linux(fedora),则可以使用 kompare;如果使用 linux,则可以使用不同的命令,例如 此链接,其他命令是 < code>diff,
comm -23 filedump1 fuledump2
,sort filedump1>文件转储1.已排序
等是比较文件中文本的实用程序排序fuledump2> fuledump2.sorted
diff filedump1.sorted fuledump2.sorted
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 arediff
,comm -23 filedump1 fuledump2
,sort filedump1 > filedump1.sorted
etc are utilities to compare text in filessort fuledump2 > fuledump2.sorted
diff filedump1.sorted fuledump2.sorted
PostgreSql 的转储文件就像普通的数据文件一样。
您可以使用任何实用程序/工具来查看它们之间的区别。大多数操作系统都为此构建了实用程序
例如:
vimdiff dump1 dump2
(http://alvinalexander.com/linux-unix/vimdiff-直观地查看多个文件差异)
fc dump1 dump2
(http:// www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fc.mspx?mfr=true)
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:
vimdiff dump1 dump2
(http://alvinalexander.com/linux-unix/vimdiff-see-multiple-file-differences-visually)
fc dump1 dump2
(http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fc.mspx?mfr=true)
我将使用 WinMerge 来比较架构转储。数据转储不会被排序(我刚刚打开关于此的错误报告),但是有更好的工具可以做到这一点。
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.
您可以尝试进行简单的文本比较(
diff
命令或类似工具)。如果您需要更多,可以使用一些进行数据库比较的工具。例如:
apgdiff 比较转储 - 但仅比较架构(而不是数据)。用 Java 编写。
pg_comparator 比较 2 个表中的数据(不是来自转储,但来自 1 或 2 个实时数据库)。它是用 Perl 编写的。
免责声明:我没有尝试过。
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:
apgdiff compares dumps - but only the schema (not the data). Written in Java.
pg_comparator compares data in 2 tables (not from dumps, but from 1 or 2 live databases). It is written in Perl.
Disclaimer: I have not tried them.