1

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). – Chris Kenst Mar 13 '17 at 16:34
  • Is your question about just tool ? or to further automate it too? – Rao Mar 14 '17 at 5:46
  • 1
    oracle? mysql? postgres? – Michael Durrant Mar 15 '17 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 Apr 6 '17 at 10:01
1

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.

Syntax:

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 \
        --referencePassword=bob
    --diffTypes=data

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

0

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 – trashpanda Mar 13 '17 at 13:17
  • There are a lot more: stackoverflow.com/questions/685053/… I just happen to like Red Gate's product. :) – Niels van Reijmersdal Mar 13 '17 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 Mar 14 '17 at 2:15
0

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

https://chadthompson.me/2012/08/first-steps-with-oats-recording-a-test-with-openscript/

https://docs.oracle.com/cd/E25294_01/doc.920/e15487/chap3_os_fm.htm

0

If using MySQL you can use the mysql mysqldbcompare tool.

https://dev.mysql.com/doc/mysql-utilities/1.5/en/mysqldbcompare.html

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, privacy policy and cookie policy

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