Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm new to Oracle databases. I have used to SQL Server and the description fields (MS_Description) for tables and columns for documentation purposes. Is there an equivalent for Oracle? What is the best practice for documenting Oracle database?

share|improve this question
1  
you might also be interested in this related question –  Jack Douglas Sep 26 '12 at 10:47

3 Answers 3

up vote 8 down vote accepted

In Oracle, you would use the COMMENT command to:

[...] add to the data dictionary a comment about a table or table column, view, materialized view, operator, indextype, mining model, or edition.

Most tools (PL/SQL Developer, Toad...) will display these comments in appropriate fields when you browse the database schema.

The comments can be queried directly with the *COMMENTS dictionary views, such as ALL_TAB_COMMENTS.

share|improve this answer

Oracle exposes its data dictionary through views. You can use these views to query the information you need.

The main views that you'll need to use are:

  • DBA_OBJECTS - lists all DB objects
  • DBA_TABLES - list all tables (and their owners, which are schemas in Oracle)
  • DBA_TAB_COLUMNS - list all tables and their columns

There are also ALL_% and USER_% equivalents of these views (eg: `USER_TABLES) that only show all objects you have permission on, and objects you own.

share|improve this answer
1  
Thanks for this answer but I think you misunderstood my question. I know that I can query these objects, but how can I write my own metadata e.g for columns? If if have a column CustomerID I might want to add 'Surrogate id generated by ETL-process`. See for example this link –  jrara Sep 26 '12 at 10:04

In Oracle there are table and column comments that can be used for documentation.

These comments can easily be added by the following commands:

COMMENT ON TABLE my_table IS 'Documentation of my table'
/


COMMENT ON COLUMN my_table.my_columns IS 'Documentation of my column'
/
share|improve this answer
    
thanks Peter and welcome to dba.se :) –  Jack Douglas Sep 26 '12 at 10:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.