December 14, 2006

How to query Oracle Schema

I have been trying to query the difference between Oracle Schemas for a project I'm working on.

  • get SQL Developer (free) from Oracle

  • I needed was a list of the system tables in Oracle which I found here.

  • Next log in as the user who's schema you want to print.

  • The basic query you want is:

    SELECT
    t.table_name
    , column_name
    , data_type
    , data_length
    FROM USER_TABLES t, USER_TAB_COLUMNS c
    where t.TABLE_NAME = c.table_name;

  • run the script using F5 and select the Script Output tab

  • Save the output


You can repeat this process for other schemas and use a diff tool like beyond compare to find the differences.

No comments: