Oracle INFORMATION_SCHEMA

From the Database Geek.

Part of the ANSI SQL standard calls for an INFORMATION_SCHEMA. This schema contains a standardized data dictionary that is (or is supposed to be) common across various databases. Most database vendors offer a native data dictionary and a sub-set INFORMATION_SCHEMA (called info schema from this point on). Oracle is the only major database vendor (that I know of) that doesn’t even offer a subset of the info schema.

Oracle’s data dictionary (especially if you include the V$ views in that) is the most robust of all the databases I have used. If you are knowledgeable about the data dictionary, you would never have any reason to use the info schema. I’ve had discussions with people (inside and out of Oracle) and the general consensus is people ought to learn the Oracle dictionary if they plan to use Oracle. In my opinion, that’s a bad attitude. The info schema may be training wheels, but at least they would be available for newbies who need those wheels.

The info schema is also part of the standard and I think standards are a good thing. Anyway, whether it ought to be there or not is a moot point. All of the information that you would find in the info schema (at least those things that are pertinent to Oracle) are available in the data dictionary. Seeing that that’s the case, I have started a new open source project called the Oracle Information Schema. It is hosted on sourceforge.net.

The first version of the package includes:

  • CATALOG_NAME – The database name
  • SCHEMATA – Info about database schema
  • TABLES – all_tables type information
  • VIEWS – all_views type information
  • COLUMNS – all_tab_columns type information
  • ROUTINES – a combination of all procedures and all source
  • DOMAINS – all_types type information

I plan to add plenty more. If you will be working with Oracle databases (and are an Oracle newbie) or if you have newbies in your databases, or even if you just want to learn about the info schema, download the Oracle Information Schema package and start using it.

You need SYSDBA permissions to create the INFORMATION_SCHEMA user but you can install the views under your own schema if you don’t have that kind of access.

If you want a particular view, send me a request or write it up and submit it. Eventually, I would like to have a complete implementation of the INFORMATION_SCHEMA.

You can download the code here.

LewisC

Technorati : , , , ,

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

2 Comments »

 
  • Jorge Carrillo says:

    Hi,

    This is good work! I think it’s sad Oracle does not provide these views. It makes life easier for those of us who write SQL in several dialects.

    Two things. One, I had problems running the scripts on Oracle XE. It has limitations on what a user can do if that user isn’t one of the system users. I just ran these as system and created them on behalf of the information_schema user.

    Secondly, I’m working on creating some of the constraint views. Can I send these on to you?

  • Lewi says:

    Sure. Send them to me and I’ll add them in.

    Thanks.

    Lewisc