Link to home
Start Free TrialLog in
Avatar of Akai123
Akai123

asked on

How to get object discription from databases using a script.

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
ASKER CERTIFIED SOLUTION
Avatar of chaau
chaau
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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