Database compare tools - database

My company has a number of relatively small Access databases (2-5MB) that control our user assisted design tools. Naturally these databases evolve over time as data bugs are found and fixed and as the schema changes to support new features in the tools. Can anyone recommend a database diff tool to compare both the data and schema from one version of the database to the next? Any suggestions will be appreciated: free, open source, or commercial.

I use Red Gate Sql Compare for comparing schemas. It also has an interesting feature that allows you to save a snapshot of the schema which you can then use in later diffs. for example compare the schema of today with the schema of a month ago.

I use ApexSQL Diff. It is an excellent tool for doing just what you're describing...compare schema, compare data, generate change scripts. It not free, but it works well.
NOTE: ApexSQL Diff only works with SQL Server.

We never actually purchased it as we ended up using SQL Server 2005, but DBDiff seemed to do the trick: http://www.dkgas.com/downdbdiff.cgi
It works with any ODBC compatible DB.

I've used Total Access Detective in the past and it did the trick. It's a while ago though so you might want to investigate first...

If you're looking for a free alternative to Red Gate's most excellent SQL Compare, you might want to check SQLDBDigg made by SQLDBTools. It's what I used until I caved and bought SQL Compare.

It's not a perfect solution, but I often export both databases as txt/SQL files and then use a diff program, such as the one that comes with TortoiseSVN. You can then see all of the differences. It doesn't automatically create the SQL though to sync the dbs.

http://www.diffkit.org
Features
High performance, for large datasets (+10MM rows).
Very low memory overhead, even on very large datasets.
High quality-- comprehensive embedded regression test suite for the application/framework.
Java run everywhere (tm) — Linux, Solaris, OS X, Windows, etc.
Cross database-- Oracle, MySQL, DB2, and any JDBC datasource.
Command-line driven; no GUI needed; can run in headless environments.
XML configuration file driven.
Free Open Source Software.
Apache License, Version 2.0.
Clean Object Oriented Design make extension easy.
Easily embeddable as a Java library (jar).

Related

Choosing database and licensing for Delphi application

We have Delphi XE2. We are looking for a database for our application. We have tried Absolute Database and it supports most of SQL commands we need. I see most of Delphi users choose Firebird but it seems to hard to work with. I am so much confused about databases and licenses. Here are my problems:
When we choose a database, let's say Absolute Database, Firebird, MySql embedded etc. and if we have for example 3.000 customers, do we still need to pay to Database developers? Or is it one time fee? I am so much confused because they say when we buy, we can use it inside our building ( http://www.componentace.com/order/licenses.php ). But when we release our software, our customers will need to use the same database of course.
Absolute DB is easy to install and supports most of SQL queries. Firebird does not support most of SQL queries. Is this correct?
When we try to use Firebird, we use FlameRobin to design database. But when we try to connect using IB components, it says "Unable to connect database".
Thank you very much...
Firebird has no licensing fees at all. However, it's smart to help maintain this great project once you rely on it. There is a lot of ways to help Firebird project:
http://www.firebirdsql.org/#consider-your-contribution
Not correct. Firebird is very powerful and supports most SQL standards plus a great SQL extensions for stored procedures and triggers
Check your database connection string. It's usually something like server_ip:full_db_path if you're connecting over a network, or just full_db_path if local. You can always use an ALIAS in place of full_db_path. Make sure you have Firebird server running or, if using embedded, if it's installed correctly. Firebird has a great and very complete documentation and one of the best support groups on open source projects.
It depends on database. Absolute Database is embedded database, everything is included in your exe. Most database engines however are standalone, so they are installed as applications. It looks like if you buy commercial Absolute Database licence, no royalties are needed: http://www.componentace.com/order/order_product.php?id=8
Firebird supports most SQL standards. According to this answer, most SQL compliant embedded database is Firebird: Which embedded database has maximum SQL compliance, and concurrency support?
You must have some configuration issues with IB components, hard to say more without more information. On the otherhand, IB components are for Interbase, so you might find something else better, like UIB.
If you'll choose Firebird, then take a look at IBExpert. This is absolutely the best administration tool available for Firebird. But not cheap. =(
You should also look at Interbase, also marketed by Embarcadero, the Delphi vendor. Interbase is not the same thing as Firebird, which is probably why the IB components you mentioned didn't work.
Yes, each customer will usually have to purchase the IB database. However, there are additional choices with Interbase, depending on how you structure your application. Check how they work and see if they can fit better with what you are trying to do.

SQL Server diff tool

Working on a team where people are prone to amending dev SQL Server tables and forgetting about it, or preparing a change for deployment and having to wait for that deployment. This leaves our dev and live tables inconsistent, causing problems when SPROCs are pushed live.
Is there a tool whereby I can enter a SPROC name and have it check all tables referenced in it in the dev and live DBs, and notify of any differences?
I know two excellent tools for diffing SQL database structures - they don't specifically look inside stored procedures at their text, but they'll show you structural differences in your databases:
RedGate SQL Compare
ApexSQL's SQL Diff
Redgate also has a SQL Dependency Tracker which visualizes object dependencies and could be quite useful here.
Marc
For SQL Server 2005/2008, Open DBDiff works pretty well. The great part about this is that it's free. Also note that I am writing this answer for version 0.9 which currently works for SQL 2005/2008.
It'll show you the differences between the database schema between a source database you specify and the destination database you specify. There are also buttons you can click that can update or create the table that is in question.
I would recommend SQL compare and SQL Data Compare from Redgate Software. I worked with these tools for several projects and they did a great job. Documenting changes is also a good thing to do, but some changes are to complex to write your own SQL code for (including juggling data around between tables).
The redgate tools create scripts in a matter of seconds and those scripts are almost always correct (some older versions had a hard time with table dependencies in big databases, but when playing around with the statements (in a begin transaction / rollback) I was able to quickly fix those problems).
Another strong point in the redgate suites is that you can save your comparison project. This is especially useful when you don't want to convert a certain table (or data), you can exclude them. When loading the project the next time the software will automatically ignore those tables.
One disadvantage is the cost of the software (smaller companies I worked with did not want to buy the software). SQL compare and SQL data compare together will cost you about 800 dollars, but if you look at the time you will save when releasing you will save a lot of money. There is also a trial you can play around with (30 days I believe).
SQLDBDiff is a nice and user-friendly and lite tool.
SQLDBDiff supports SQL Server 2000 to 2016 and also SQL Azure.
SQLDBDiff available with both free with limited use and full with a trial.
More Screen
Try Microsoft Visual Studio Database Edition aka Data Dude (formerly for Database Professionals). It'll do a complete schema comparison and generate the necessary scripts to upgrade the target schema.
Of course, this shouldn't replace a proper build process ;-)
If you need a quick schema comparison tool for SQL Server, you should take a look at dbForge Schema Compare for SQL Server.
I've made a MssqlMerge utility that allows to compare (and merge) MSSQL database data and programming objects. It also allows to search for particular word or phrase across table definitions and programming objects.

Comparing database structures: how to create an SQL patch?

I have two SQL Server (2000) databases. Both are used for the same project, but different versions. Basically, the old database is from our TEST environment. The new database is from the DEVELOPMENT environment. We also have an ACCEPTANCE, PRODUCTION and MAINTENANCE environment and they all contain the same project. (It's our development street, moving versions from D to T to A to P and finally M.)
Now, the development database structure has changed. A few tables have been added, indices are added or removed, fields have changed in type and nullable fields have become non-nullable, things like that. The test database needs to be upgraded with the new structure but without any loss of data. Right now, I'm doing this with a lot of manual labor. I keep a list of structural changes and once everything is ready, I write an update script to patch the old test database.
But as a software engineer, I'm just lazy by design. So, is there some easy tool somewhere which will compare the two database structures and generate an update script by itself?
(Only to change the structure, btw. No data manipulation!)
Yes, the best one in my opinion is by Red Gate
The SQL Toolbelt they offer is very good, which includes a bundle of tools, or you can just get SQL Compare on it's own. Not free (except for 14 day trial I think), but well worth the money
Take a look at Red Gate's SQL Compare..a complete live safer
At work we've used a few tools; AdeptSql Diff and we were trialing Redgate-something-something.
AdeptSql was significantly cheaper than Redgate, and while Redgate had a lot of very nice bells and whistles, since we already owned Adept we decided to stay with it.
http://www.adeptsql.com/
I'm sorry that I don't know any free tools offhand; I know that Redgate at least has a trial period.
I have used a *nix command-line tool called sqlt-diff which uses Perl SQL::Translater (SQLFairy) to generate diffs between SQL database schemas.
https://metacpan.org/pod/distribution/SQL-Translator/script/sqlt-diff
This is a free open-source tool. I did manually edit the diffs generated to customize them slightly.

How to validate the clients database against my database schema?

Our clients use SQLServer/Oracle databases. Over the years, we've sent them many update scripts which they had to run manually. Most of the time, everything went smooth, but every now and then a script did not run completely to the end or had some errors in it (which weren't detected at the time of the upgrade). Also, sometimes even "smart users" added indexes/tables into those databases themselves, for whatever reason. Later on, those irregularities lead to problems.
Now I have been tasked to figure out a way to verify/validate our clients databases against our own database schema (tables, datatypes, indexes, views, ...). The output should be some kind of difference file indicating what is missing/what should not be in the database. I could do this in code (C++) from inside our application or I can create an external tool for just this one purpose.
Now before I start coding, I wanted to ask if there is already a tool out there that would produce the necessary results, or that at least could help me produce a decent xml file from our master-databases (Oracle and SQLServer)? Or is there a library which could help me write my own tool?
I've used this technique before and it doesn't require buying any tools.
Enterprise Manager has a "Create Script" feature. Perform this on your reference database and the comparison database. Select the appropriate options to generate scripts for the objects you care about. Next, just compare the two generated files with your favorite diff tool.
You can do a similar procedure with Oracle tools that let you export the DDL scripts.
There are three options using Red Gate's tools:
Have your client run the comparison.
You would need to convince your
clients to purchase a license of SQL
Compare and send them a schema
snapshot of your database.
Write an application of your own using Red
Gate's SQL Comparison SDK ($595 for
10 distributions) which can be run
at the client site.
Ask your client to send you a schema snapshot and
run the comparison yourself using your own
copy of SQL Compare. Red Gate
supplies a free schema snapshot tool
called SQL Snapper that will create
snapshots that can then be emailed to you
by your client. As this doesn't include any data, it may be something your client is willing to consider.
The SQL Snapper tool and SQL Comparison SDK sample code can be downloaded from our labs.red-gate.com website.
Oracle compatibility is now available in the form of an Early Access Build. If you're interested or would like to try out the tool visit the product page. You can use this for free until the full release of the tool.
David Atkinson, Product Manager, Red Gate Software.
We use Redgate SQL Compare for this and it's served us well over the years.
We also use Redgate SQL Data Compare for comparing the content of lookup tables.
The folks at redgate have a great tool called SQL Compare.
Can you create a schema dump like MySQL's SHOW CREATE TABLES?
If you're on Windoze, I have used Advanced Query Tool for years, and can attest that, for the money, it does more than anything else. In particular, it will generate a diff report between databases. It is ODBC/VB6, and can run against dozens of databases. Check it out. (No, I am not of QueryTool nor do I own any part of it, just a happy client.)

What are the real benefits of Visual Studio Team System Database Edition (GDR)?

Interested if anyone has used VSTS Database Edition extensively and, if so, which features did you find the most useful over the standard Visual Studio database projects?
What are the most compelling features as opposed to alternative schema management options or tools like RedGate's SqlCompare etc?
Edit: Microsoft just released the RTM version of Database Edition (GDR) which adds support for SQL Server 2008 - link is here. I've previously blogged (briefly) about it here.
Has anyone had a chance to do any real work with the GDR? It looks like there are some real enhancements including refactoring support. I'd be really interested to hear if people are using it with SQL Server 2008...
Download From: [http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&displaylang=en]
We use the database edition functionality of Team Suite on Stack Overflow. As Vaibhav said, mostly it is useful because it gives you a one-click way to reverse engineer a database into source control, and keep it up to date.
Note that it also has decent Data and Schema compare tools as well. You can compare projects to physical databases and vice-versa. This makes it pretty easy to keep your database up to date, no matter where you make changes -- in the filesystem database project, or in the physical database itself.
If you compare it to tool like RedGates, that are specifically taylored for SQL Server, the benefits are that if you have the proper MSDN subscription you do not have to spend more money for other tools (but keep in mind that RedGate tools are much more mature) and it covers some points (like regression tests and unit tests at the DB level) that other tools do not cover and it make so in a integrate manner with other testing tool of VSTS, so that you can record results in Team System.
Compared to a tool like Embarcadero ErStudio (my solution of choice) it misses the cross database features, and this is a big problem, at least for me.
If you are a "all Microsoft" shop with the proper MSDN subscription it could be worth spending time on it.
We are currently using the GDR 2008 projects for managing our entire database development and deployment on a greenfield system. We use a TFS build script to call out to the MSBuild task for deploying the databases along with executing the data generation plans for pre populating the testing environment with data.
The key with the data generation plans was finding the build task to use which is :
TaskName="DataGeneratorTask"
AssemblyName="Microsoft.Data.Schema.Tasks, Version=9.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
All of this gdr project work has been unbelievably helpful and I think it is well worth the learning curve to get to know these project types. The value they provide is astronomical in productivity and visibility.
It allows us all to view the entire system in a single visual studio solution along with allowing us to start with a clean slate of our system at any point in time with either a click of the deploy command or a custom build configuration.
This blog
will help with getting the TFSBuild script to run if you're interested.
The VSDB test integration is so painful to configure that we abandoned it, and that's the only thing it's got that Red-Gate doesn't.
Red-Gate's tool is miles more useful. It does live DB and scripts in folders, but also has "snapshots." The aspect of Red-Gate SQL Compare that gives it the win is its Snapshot ability and the fact that your license allows you to deploy their assemblies and use them to perform database maintenance at customer run-time.
It has made upgrades in the COTS application that I develop a breeze. A Snapshot is a binary schema representation. You can package them as resources in an assembly, then use the snapshot in a customer run-time schema compare to bring an existing database up to the current rev.
Probably the best advantages are around being able to version control individual DB schema objects (which you could do with the older "Database Projects"), but have the power to "build"/deploy the project and convert those individual scripts into a complete database.
The ability to import scripts and have the Wizard covert individual schema items into separate files is very handy if you've inherited a DB schema.
Given that recently the licensing model changed, it makes it even more enticing because it's included with the Developer edition SKU. It also provised support for "Database Unit Tests" which might be useful.
From the 2008 GDR, I understand that they now support SQL Server 2008.
You can do database versioning for one. That is useful.
The other thing that is really useful is the ability to define type of seed data for testing. Through this Visual Studio will populate the database with random data and this is great for testing purposes.
There are other benefits as well of course.
It is always useful to put everything under the same source control, so your data-dude can be shelving, checking in, compare with history, and even resolve workitems and bugs using the same tools that other team members are using.
Also to be able to have one versionning mechanism across the whole application, in other words, it doesn't make sense to say that my source control has all the versions of my project while your database can't fit with any of these old versions, unless you take a backup or a snapshot of the database with each build.

Resources