Is it possible to compare two databases with identical structure? Let say that I have two databases DB1 and DB2 and I want to check if there is a difference in data between them.
There are several tools out there:
Free Ones:
- pgquarrel: http://eulerto.github.io/pgquarrel
- apgdiff: http://apgdiff.com/
- Liquibase (Cross DBMS): http://www.liquibase.org
- WbSchemaDiff (Cross DBMS): http://www.sql-workbench.net/manual/compare-commands.html
- Migra: https://migra.djrobstep.com/
Commercial:
- DB Comparer: http://www.sqlmanager.net/en/products/postgresql/dbcomparer
- Aqua Data Studio: http://docs.aquafold.com/docs-diff-schema.html
- DB Solo: http://www.dbsolo.com/index.html (30 day trial)
- PostgresCompare: https://www.postgrescompare.com/
Try using pg_dump
on both databases and diffing the files.
Another free app:
DBeaver - you can select databases, tables, etc to compare with each other
I'm working on a comprehensive comparison tool for Postgres. It will be free while in beta.
Initially this is just schema (DDL) comparison but we will probably expand to data also. I believe this is a tool that a lot of shops require in order to move from their current RDBMS without having to also change how their development environments, operations etc work too.
The best tool which I ever seen https://pythonhosted.org/Pyrseas/
Get dump from database A dbtoyaml ...
Generate migration from A => B yamltodb ... [file generated in step 1]
I'm also looking for a tool to compare data in databases (in particular I was interested in comparing Redshift DB). So far the best I found is https://www.dbbest.com/products/database-compare-suite/#close. Unfortunately the free trial expires after one day.
I recommend DB Best Database Compare Suite - trial version is only for 2 days, but it allows you to compare scheme and data.
来源:https://stackoverflow.com/questions/4804779/how-to-check-difference-between-two-databases-in-postgresql