I need to compare two databases which have many tables in it.
Both databases are the same but we are running different scripts to load and validate the data.

  • How will i do this?
  • Can I use Selenium?
  • 1
    Selenium is for interacting with web applications. My guess is you'll want to run some SQL queries or stored procedures to help you test this, not a web interface (which is then subject to changes in the web app and not the database). Commented Mar 13, 2017 at 16:34
  • Is your question about just tool ? or to further automate it too?
    – Rao
    Commented Mar 14, 2017 at 5:46
  • 1
    oracle? mysql? postgres? Commented Mar 15, 2017 at 2:13
  • SQL Server, neo4j, Cassandra, MongoDB? There are specific tools for each of these that will answer your question but there are some general principles that can be leveraged, but depends on your tech ...
    – Marcus D
    Commented Apr 6, 2017 at 10:01

4 Answers 4


Liquibase is a tool that offers this kind of functionality among others, assuming you can establish jdbc connections to your databases.

There is a diff command that takes the connection parameters of 2 databases, and it reports their differences.

In order to report data changes you will need to use the --diffTypes=data option.


liquibase.sh --driver=oracle.jdbc.OracleDriver \
        --url=jdbc:oracle:thin:@testdb:1521:test \
        --username=bob \
        --password=bob \
    diff \
        --referenceUrl=jdbc:oracle:thin:@localhost/XE \
        --referenceUsername=bob \

reference: http://www.liquibase.org/documentation/diff.html


Yes you might be able to use Selenium, if you can check it manually from the user interface and it is a web-application.

Not sure it is the fastest or easiest way to compare two databases though. Selenium is created for testing functional behaviour, not data validation.

Maybe it is easier to use a SQL compare tool, like this one: http://www.red-gate.com/products/sql-development/sql-compare/

  • 1
    There's DB Forge too, we used it at my old place for comparing databases (data, structure, copying, etc.). I imagine they're fairly similar, but the prices are on their website - devart.com/dbforge/mysql/studio
    – dvniel
    Commented Mar 13, 2017 at 13:17
  • There are a lot more: stackoverflow.com/questions/685053/… I just happen to like Red Gate's product. :) Commented Mar 13, 2017 at 13:27
  • Yes am using Red Gate product now but it is taking more than 18 hrs to finish off its task of comparing the db's.
    – Ajeesh
    Commented Mar 14, 2017 at 2:15

To achieve the purpose there are many automation tools out there. I would suggest to use OATS tool (Oracle Application Testing Suite). I find it more comfortable than Selenium .

It has lot of inbuilt features. Functional Testing, Load Testing, Webservices, Data Base Testing.

To Compare two data bases is quite easy. Follow the link for more details information




If using MySQL you can use the mysql mysqldbcompare tool.


This utility compares the objects and data from two databases to find differences. It identifies objects having different definitions in the two databases and presents them in a diff-style format of choice. Differences in the data are shown using a similar diff-style format. Changed or missing rows are shown in a standard format of GRID, CSV, TAB, or VERTICAL.
Use the notation db1:db2 to name two databases to compare, or, alternatively just db1 to compare two databases with the same name. The latter case is a convenience notation for comparing same-named databases on different servers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.