DBComparer is a utility for:

  1. mass-extracting table data from databases into files
  2. mass-extracting definitions from database objects (views, triggers, stored procedures, etc.) into files.
  3. Utilizing a file difference tool such as WinMerge to compare between two extracted versions.

Usually this tool is used to check development databases against other versions, or test databases against each other or a reference database.

DBComparer relies on the capabilities of the database to extract the needed information (data and definitions) using special meta-data queries.

After configuring the several queries to get metadata from the database (see Installation/Configuration below), press on one of the compare DB buttons to start fetching either data, definitions or both.

The data are fetched using "select * from <tableName> order by <keys>", where <keys> are either the table's primary keys or just 1 (the first column), if no primary keys are defined. The generated select statement is written in the first line of the dump file for checking.

Fetching can be cancelled anytime by clicking on Cancel Compare. Progress can be monitored in the status area left to the cancel button.

When dumping data and definitions, the whole source and target folder can be removed before. If it's not removed, you can decide whether to skip already fetched tables/objects. This is useful when resuming a cancelled dump operation. Of course the removal of the folders is always the safest comparision option, as data/definitions might have changed in the meantime.

There is also a command line interface which can be accessed by 

DBCompare.exe DATA|DEFS|CLEAN|SKIP dbcompareDefinitionFile1 [[dbcompDefFile2] dbcompDefFile3]]

DATA...dump DATA using the following dbcompare Definition Files
DEFS...dump DEFINITIONS (Views, Triggers, Stored Procs using the following dbcompare Definition Files
CLEAN...remove the DATA and DEFINITIONS before comparing (the top source/target folder is removed)
SKIP...skip any existing DATA or DEFINITION files (continue with a cancelled dump)

DBCompare.exe DATADEFS dbcFile1   ...  compares data and definitions according to dbcFile1...
DBCompare.exe DATACLEAN dbcFile1  ...  compares data according to dbcFile1 and removes source and target folders before...
DBCompare.exe DEFS dbcFile1 dbcFile2 . compares definitions according to dbcFile1 and then according to dbcFile2 ...

If invoked without any parameters, the GUI version is brought up. The commandline version sends progress messages (similar to the status area) to STDOUT, error messages are sent to STDERR.

Installation and Configuration

First you need to have a diff utility capable of handling differences on a folder level, such as WinMerge.

The installation is simply done by putting the executable DBComparer.exe into a folder of your choice.

Configuration is done in so called dbcompare definition files. You can there define

You can save your definitions by clicking the save button. If the given name is "default.dbc", this dbcompare file will be loaded at startup of the tool.
By clicking "Load", you can choose a definition file processing.

Known Issues/Limitations

Currently only tested with MS SQL Server 2000 and 2005.

History Logo