?
Solved

How to get object discription from databases  using a script.

Posted on 2014-07-22
3
Medium Priority
?
307 Views
Last Modified: 2014-11-05
Hi,
I have a data base having 160 tables. I need a SQL script which can output table name and its description
accessing oracle metadata.

The script should spool output the Describe Table for each and every table  in following way.

1) desc TableA
    id1      number
    c1       varchar2(150)
    n1      nuber(p,s)
    d1     date
2) desc TableB
    id2      number
     n2      nuber
    c2       varchar2(150)
    n3      nuber(p,s)
    d2    date

Basically I want to compare the same set of tables between the 2 data bases to find the deviations since they exists in our environment.
deviations like 2 different data types
more columns in one DB and less in other for the same table.
If I can spool information in a text file I can find diff using a tool. If there is another easier way without creating db_links I will go for it.
Please help me to find a way without comparing table by table manually.
Thanks

I
0
Comment
Question by:Akai123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Accepted Solution

by:
chaau earned 1500 total points
ID: 40213216
The easiest way to do this is to use a '*' wildcard for the describe command, like this:
DESCRIBE '*';

Open in new window


Bonus answer:
To get the list of all user tables use this command:
select tablespace_name, table_name from user_tables;

Open in new window

To get the list of all tables in the database use:
select tablespace_name, table_name from dba_tables;

Open in new window

To get the list of all columns for all tables use:
select * from ALL_TAB_COLUMNS order by owner, table_name, column_name;

Open in new window

To get the list of all columns for user tables use:
select * from USER_TAB_COLUMNS order by table_name, column_name;

Open in new window

I think this last query will give you a nice list to work with your favourite text comparison utility
0
 
LVL 16

Expert Comment

by:Wasim Akram Shaik
ID: 40213423
you should use something like this.. get the output of the below query from both databases against the user.

this will provide the output you are looking for

select table_name,column_name,data_type from dba_tab_columns where owner='USER_NAME'
order by table_name,column_name
0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 40214920
I recommend SchemaSpy, it will create nice HTML documentation and it's released under GNU General Public License.
;)
Or...you can re-invent the wheel.
:p
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question