Decipher database schema [closed] - database

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I've recently inherited the job of maintaining a database that wasn't designed very well and the designers aren't available to ask any questions. And I have a couple more coming my way in the near future.
It's been tough trying to figure out the relationships between the tables without any kind of visual aid or database diagram.
I was wondering what tools are recommended for this. I know about Visio, but I was hoping there were some good open source/freeware applications out there. I don't need it to change the database at all. Just read it and create some kind of visual aid to help me understand how things are laid out and try to figure out what the designer was thinking about how the data should relate.
Additional answer data: SchemaSpy was the kind of thing I was looking for, but having not done a lot with the command line in ages, I opted to use SchemaSpyGUI. There was also some configuration to get used to since I don't work with Java much, but the end result was what I was looking for (on open-source replacement for Visio's ER diagrams).

Try SchemaSpy. I ran it against a rather complex database and I was quite pleased by the result, with advice on optimization.

Try DBVis - download at http://www.minq.se/products/dbvis/ - there is a pro version (not needed) and a open version that should suffice.
All you have to do is to get the right JDBC - database driver, the tool shows tables and references orthogonal, hirarchical, in a circle ;-) etc. just by pressing one single button. Enjoy!

What DBMS (Database Management System) are you using? Many modern DBMS's like SQL server and Access can create an E-R diagram for you.
Microsoft Visio is an excellent tool and can reverse engineer SQL from any datasource.
DDT (Database Design Tool) can reverse engineer from raw SQL on windows and is very lightweight (very small free download).
MySQL Workbench is one of the more popular MySQL tools and has a freely downloadable version.
SQLFairy can do the same for MySQL on Linux.

dbdesc is not free, but I've heard very good things about it. It works with several of the major databases out there.
I have been lucky in that I haven't had to decipher other people's database schemas yet. I have use a set of templates that come with CodeSmith.

Firstly, may I say that I feel your pain!
Here are a couple of my tips:
In general, a tool will only be helpful if the designers have correctly defined all the primary and foreign keys, so be aware that a tool might not pick up all the important relationships.
The most useful thing is to see what queries are being performed by the client code. This will tell you not only what relationships exist, but which tables and relationships are the most frequently used - that's where you'll want to concentrate your effort.

There is a bit of open-source software out there but Visio Professional's tool for reverse-engineering database schemas is quite good because it de-couples the process of reverse-engineering and diagramming. I use this a lot because it tends to be readily available at most sites.
One nice feature of visio is that you can reverse engineer and then construct your own diagrams from the reverse-engineered schema. Doing this is a very good way to explore the schema and understand it as you are doing this work as a part of interactively building a reference document for the schema. I've used this technique to reverse engineer everything from Activity Based Costing Systems to Insurance Underwriting Systems, typically without much help from the vendor. Tinkering about with Visio diagrams is quite relaxing.
Between this and a little hypothesis testing about FK relationships (If the FK is not physically present on the table) you can make sense of quite complex schemas. I've found this diagramming approach makes Visio a head-and-shoulders leader because you can easily interact with the reverse-engineered model in a fairly convenient way. You can fill in missing foreign keys, build subject area diagrams and add annotations on the diagrams. The interactivity of this process makes it a good learning tool.
This is a somewhat subjective view but the interactivity works very well as a learning proces for me and it's by far my preferred approach. Most sites won't begrudge you the £300 or so for a license - if they don't already have it available. The only site I ever worked where they had to get it in was because they had Visio Standard instead of Pro. I asked nicely and the PHB signed it off.

I use mysql workbench (http://www.mysql.com/products/workbench/) for mysql databases. You can attach the workbench to your database and it will draw the ER digram for you.

Using pgsql/win32 I found the easiest solution was to write a perl script that made use of Graph::Easy from CPAN. Query the database for foreign key relationships, make a directed graph with tables as nodes and FK relationships as links. If this is your setup, I can post the code.

I like to try and see if the applications that use the database have ways of logging the SQL they use (or the DB backend itself, but that tends to be less tractable). Getting a feel for what requests performed on the database helps you concentrate on the important tables.
As with most things, the 80/20 rule applies here: 20% of the tables will do 80% of the interesting stuff. Once you've figured them out, a diagram is rarely necessary.

Look at the primary key foreign key relationshsips that have been set up as a starting place.
Since a database without existing diagrams, may not have relationships set up formally, I look at the table structures and names and make my best guesses as to what might be related to what, then dig into the structures to see if there are obvious (but undefined) foreign keys. I look at the stored procs to get an idea as to how the tables are joined and what fields are being queried on.
While automated tools to figure out the database can be spiffy, I find that when I really dig into the details of the database myself, I end up with a much better understanding than I can get from any picture created automatically.

I have some pretty good experience with Aqua Data Studio for reverse engineering a DB schema. It is very feature rich and supports even more exotic databases like Informix or Sybase.

This helped me with generating the ER diagrams on MS SQL Server 2012:
MS SQL Server management Studio > File menu > "Connect Object Explorer"
Choose your Database node and expand it. under this node you'll find a sub-node called "Database Diagrams"
Right click on "Database Diagrams" > "New Database Diagram" > Add tables that you wish to see their columns, relationships, ...

Use Visio. If using Vision 2010, you will need to use the Generic OLEDB Provider for SQL Server to ensure that there will be no problems with connecting to the Visio Driver.

Related

Any tools for Understanding Existing Foxpro Database Model?

I have some dbf files of foxpro database. However, I have no idea about what are relationship between tables regarding foreign key, what tables are inter related and so on. Is there any tool which can help me to learn relationships easily. I mean which can draw relationship instead of me figuring out by hit and try.?
I want to export this database to Microsoft SQL Server. So I want to learn whole database schema to learn tables logic.
Thanks
Is this just a set of VFP free tables or is there a VFP database, as well? If there's a database, you'll have files with DBC, DCT and DCX extensions. If you have those, open the database and take a look:
OPEN DATABASE whatever
MODIFY DATABASE
If there are relationships defined between the tables, you'll see them there.
VFP ships with a program called GENDBC that will generate code to recreate a database. Since it's all SQL code, that might help you to see what's in there, as well.
The Stonefield Database Toolkit is designed to work with Visual FoxPro and has a lot of documenting ability. Not free though.

TFS2010 Database Schema Explanation

By looking at the default, raw relational db schema of TFS2010 of its underlying team project collection sql database it is not necessarily self-explanatory how things work there and I was wondering whether someone has a more process oriented explanation how all these tables are related to each other. It seems like only 3 or 4 actually do have fk relations and such, the other ones are logically connected and would require joins and that's the part I am interested in & want to understand. Does anyknow have or know a more detailed explanation what's going on there?
I would strongly recommend using the TFS cube for all reporting needs, microsoft does not recommend the use of relational database as this may impact performance. As a good start you can read up about the schema, enhancements, dimensions of the TFS 2010 cube on the msdn library http://msdn.microsoft.com/en-us/library/ff432837.aspx. Also this walkthrough is very helpful to get you started with reporting against the tfs cube http://msdn.microsoft.com/en-us/library/ff730837.aspx#bkmk_tfsdb
HTH.
Cheers, Tarun

How do you transfer data from SQL Server to db4o?

I came across this question after searching for a ODBC or JDBC. To my surprise, since I am new to db4o I found there are tools to browse db4o, including a Netbeans and Eclipse plug in. However, when it comes to the question at hand, I only found one company, and the product is not being sold nor demoed (makes me think is not ready yet).
So, how do you transfer data? Is there a tool or script I have not found yet?
That's right. When it comes to db4o's dRS, in order to move your data to a relational database you need to define a Hibernate mapping. But it's definitely the way to go for this kind of migration if you don't want to do it all by yourself.
Best!
Data transfer between db4o and relational Databases (in both direction) can be easily done with db4o's tool: dRS - db4o Replication System (based on Hibernate).
BTW, db4o user forum might be very useful, you will get answers directly from core developers.
In my opinion, this comes down to the Object-relational impedance mismatch. Which is to say, except in very simple cases, there isn't necessarily a direct translation from a database row to an object. Your object model is fundamentally different than your database schema. Therefore, I would imagine that in most cases, you will have to come up with the mapping (and a migration application) yourself.
This goes generally for any relational database/object database, not just SQL Server and db4o.

What is the biggest drawback of <your favorite database>? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
We all have our favourite database. If you look objectively at your chosen database, what drawbacks does it have and what could be improved?
The rules:
One reply per drawback with;
a short description of the limitation, followed by;
a more detailed description, an explanation of how it could be done better or an example of another technology that does not have the same limitation.
Do not diss any database that you haven't used extensively. It is easy to take potshots at other technologies but we want to learn form your experience, not your prejudice.
Oracle databases are quite expensive
Oracle does what it does well but the licensing costs are horrendous. That has been improved by the release of Oracle XE but the limitations of that mean that it is a growth constraint on you solution.
Database Microsoft SQL Server 2005
Defect Lack of "INSERT OR UPDATE"
Description
Often you need to either insert or update a record in a table, depending on whether the record is present or not. Not having an atomic operation to do so leads to unnecessary transactions.
This does not happen with MySQL or SQLServer 2008.
Database PostgreSQL
Defect No SQL Profiler
We asked the developers about this at a recent conference and I understand it's now something they're looking to implement.
I love the flexibility of sequences in Oracle as compared with other databases autoincrements, but the inability to set seq.nextval as a default for a pk column is somewhat annoying, and must be trivial to fix.
Database Microsoft SQL Server
Defect Huge licensing cost
Description
SQL Server has great features and it integrates very well with .NET development. The issue is that when you have to scale up from a shared database to a dedicated database, licensing costs are really high. This, in effect, leads to databases which should really run on a dedicated server, being hosted on shared servers with performance and security issues.
This does not happen with MySQL or PostgreSQL.
Database Microsoft SQL Server 2005
Defect Badly implemented UI
Description
SQL Server management studio does not offer a great user experience:
Tabbing behaviour is weird: you are always looking for the right tab
Keeps on crashing on 64-bit versions
Missing some features of preceding version, like overview of grants of stored procedures
This does not happen with version 2000.
Database MySQL
Defect Server will start up with damaged tables
Description
If MySQL has a damaged table - from either being killed during a write or some other failure - it will quite happily start up and allow the user to carry on as if the problem does not exist. Granted it will produce some error messages in the log, but from my experience this doesn't help when you're trying to figure out why an application is behaving oddly.
Most other databases will detect and repair the error on startup or simply refuse to start with any sort of corruption.
Database MySQL 5.0.x and above
Defect Ring replication errors lead to inconsistent data on different nodes
Description
The most serious problem in production we face at the moment is that in a MySQL ring the ring itself produces an error and stops replicating.
Building a ring (or Master-Master-replication) is possible since 5.x.x: You chain the databases in a "ring" so that the replicate data to each other. Every database-node gets all the changes from all other nodes.
We assume that the error lies behind autoincrement- failures. This is known from normal replication, too, but in the new version there are no sufficinet error messages in the error log. I highly recommend not to use this feature in MySQL as long as the problems here are not fixed.
Database Oracle
Defect Did not handle long datatype well for too long
Description
Oracle only had the long datatype until 9i (I believe) at which point it was deprecated in favor of the LOBs. There is a ton of code out there, however, which still has longs and all of the related restrictions. The biggest of which was that each table could only have one long column and it had to be at the end of the columns. See here for a more exhaustive list of restricitons on the long.
Database Oracle
Problem Temp table definitions are not private
Description Many databases (eg Postgres and Sybase) allow you to create temp tables on the fly, insert into them, add indexes if you want, then query from them. Oracle has temp tables, but the temp table definitions exist in a global name space. Therefore the temp table has to be created by a DBA, you need to synchronize between the table definition they used and your code, and if two pieces of code want similar (but not identical) table definitions, they need to use different names. These differences make temp tables far less convenient for developers.
Yes, I understand the benefits for the query optimizer of having global definitions. However for me the lack of convenience makes Oracle's temp tables virtually useless for me, while I use them very intensively in Postgres.
Database: Oracle
Problem: The names of tables, procedures, columns, etc cannot exceed 30 characters. This is infuriating.
Problem: It's slapdash JDBC compliance. For example, stored procedures do not return results sets in a JDBC-compliant way, but instead of a proprietary OUT parameter type. This means you can't use higher-level JDBC abstractions.
Database MySQL
Defect Foreign Keys supported only on some table types
Description
Enough said. It has obvious maintenance implications.
From the MySQL manual
Foreign keys definitions are subject to the following conditions:
Both tables must be InnoDB tables and they must not be TEMPORARY tables.
And here:
For storage engines other than InnoDB, MySQL Server parses the FOREIGN KEY syntax in CREATE TABLE statements, but does not use or store it.
This does not happen with any other major DB.
PostgreSQL doesn't have a good failover solution, but I understand they're working on it.
Database : Sql Compact Edition
Drawback : Stored procedures are not supported.
Regardless of this limitation, this DB has its' uses especially as a client cache for application that can be smart client or distributed to mobile platforms.
Database Oracle
Defect Granularity of grants on packages
Description
You can only grant permissions on packages and not on stored procedures inside packages. Or alternatively, you can grant permissions on single stored procedures but then you put them outside of packages. This requires you to know up front who will use which stored procedure and it is really hard to refactor.
This does not happen with SQL Server.
Database Microsoft SQL Server 2005
Defect Lack of array type parameters
Description
Useful in searches, a lot of times you need to pass a series of values to be matched against. In SQL 2005 you can do a workaround by using CLR inside SQLServer. Given the usefulness it would make more sense to have this feature out of the box.
This does not happen with SQL Server 2008 or Oracle.
Database Postgres
Defect No analytic queries
Description
Analytic queries, introduced by Oracle, are part of the SQL 2003 standard. Unfortunately Postgres hasn't implemented them yet.
Database : PostgreSQL
**Problem : ** is that connector for C# for example are not really up-to-date and crash with advanced feature.
Database: All
Drawback - Poor design by people who didn't think it was important to know what you were doing when you designed a datbase. Far more problmes caused in all databases by bad design than from any missing feature. So I suppose they are all missing the "read my mind and figure out the best solution without me having to think" feature.
Any SQL DBMS
Defect: Duplicate rows
One of the virtues of the relational model is that it represents everything without duplicate tuples, i.e. using relations, which have keys and no duplicates. Unfortunately SQL isn't built that way. This makes the database developer's life needlessly difficult. SQL developers have to deal with tables without keys and debug queries that return duplicate rows.

Tool for querying databases [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to query a number of different databases mainly Oracle and Informix.
Can anyone suggest me some tool using which I can do this easily?
Try WinSQL lite at http://www.indus-soft.com/SynametricsWebApp/WinSQL.jsp. It is absolutely free and does not expire. It is only one file and does not come with any bulky DLLs. If you don't like it, simply delete the file from your hard drive.
An introduction about how to use it against an informix database can be found in this article.
I use and love DbVisualizer.
I like SQuirreL SQL Client. It's cross platform and database independent, and quite handy.
As a previous answer stated, WinSQL is one of the best "generic" sql query programs, although it is far from perfect. Generally speaking, the programs dedicated to a particular sql product are better (usually 3rd party products, not written by the SQL vendor). TOAD is a great program for Oracle (originally written by an Oracle employee in his spare time before being bought by Quest). TOAD has become a little bloated of recent versions, but is still a fantastic product. I think there are versions of TOAD for MySQL and maybe one or two others, however, the Oracle version is by far the best. When I last used Informix (2004) there was a reasonable 3rd party Java program whose name escapes me for the moment. The standard tools that come with Informix are from the dark ages (I used the Unix utilities that look a bit like DOS versions of Lotus 123), so anything else is better. I used WinSQL with Informix with great success.
The best alround one is TOAD
#littlegeek: Toad is not available for Informix. Additionally, the OP seems to want a single program that can query several different brands of DBMS, and you have to buy a different version of Toad for every DBMS you want to use it with.
Informix is not very well supported among third party database tool vendors.
Interestingly, Oracle' SQL Developer supports browsing (and converting to oracle) several databases, including SQL Server and MySQL.
Try the following:
Query Express (single 100KB executable, no install)
Query ExPlus (improved Query Express)
There is several options on this page: http://freewarehome.com/index.html?http%3A//freewarehome.com/bx/index.php%3Faction%3Dvthread%26forum%3D8%26topic%3D7136
GenDAT is not bad, but I am biased as I did write it ! It has been voted highly though.
I need cross platform now so I use Oracle SQL Developer which I think is great. It can handle other databases not just Oracle. Another good one (cross platform) is DB Solo.
I like Aqua Data Studio from Aquafold. It supports all of the major database players as well as some of the less including Informix. Great features like code beautification and syntax highlighting are perks.
We use Aqua Data
I have used Query Tool for years http://www.gpoulose.com/
It is lightwight and gets the job done.
However, I will also investigate some of the other ones listed here. Must say that SQLDeveloper and Toad are too bloated for my needs. I work on many different systems in any day, all at different clients with different security and down to very low-end machines. Having one simple tool and good SQL chops goes a long way!
I also would like to note that because I am installing it on new servers constantly, it needs to be free, or have an unlimited machine license. I'd be happy to pay for my own use of the tool, but need to be able to install it over and over again.

Resources