views:

150

answers:

6

Is there a tool for examining the configuration and schema of a database for dubious fields, relationships and configuration, similar to how static analysis tools like lint will flag dubious lines of code?

I'm not necessarily asking for normalization, but surely there's stupid stuff that can be detected without solving Hard AI or the Halting Problem.

+1  A: 

Check out DBMain. This is used to analyze and transform database models.

Ira Baxter
+1  A: 

Not sure if this does absolutely everything you are looking for...but all of red gates tools rock!

http://www.red-gate.com/products/SQL%5FDependency%5FTracker/index.htm

Andrew Siemer
A: 

We use ClearSQL for PL/SQL. Not spotless, but pretty comprehensive, fast, and I really like the user interface.

reinierpost
+1  A: 

I regularly use SqlSpec from www.elsasoft.org
It makes a nice documentation you can navigate (in html or chm formats), and works with most databases.
It's not completely flawless, but it's quite good, affordable, and the author responds emails, which I appreciate.

iDevlop
A: 

What database vendor are you targeting?

SQL Server Tool ApexSQL Enforce http://www.apexsql.com/sql%5Ftools%5Fenforce.asp

StarShip3000
Oracle. And maybe Postgres/MySQL. And SQLite if you're crazy.
jldugger
Basically, if you know a tool, mention it. Right now I just want a survey of available tools.
jldugger
A: 

I've found SchemaSpy to be useful. It generates a schema chart and detailed HTML reports via ODBC. It has an "anomalies" tab in the HTML output that describes some basic questionable designs:

  • Tables with a single column
  • Tables without a primary key
  • Missing foreign key constraints implied by field names
  • Implied primary keys
  • Columns both 'nullable' and 'must be unique'
  • Columns whose default value is the word 'NULL' or 'null', where the SQL NULL value may have been intended

It's been pretty useful. Perhaps more such rules can be added?

jldugger