I have the feeling that there are some difference between two large complicated Oracle schemas which should be identical, so decided to dump and diff them to investigate. I found an article (http://www.dba-oracle.com/art_builder_get_schema_syntax.htm) which gives the following commands to dump the table and index definitions.
SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name) FROM USER_TABLES u;
SELECT DBMS_METADATA.GET_DDL('INDEX',u.index_name) FROM USER_INDEXES u;
However, when I dumped and diffed spool of the output the schemas, there were trivial differences on almost every line making the difference worthless. For example the schema name is included in each table definition.
Is there better way to do this that will give the most important schema data in a format that can be compared easily using a diff tool. I am interested in tables, indexes and triggers.
I am using Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
The free and open-source SchemaCrawler tool that I wrote will do what you need. SchemaCrawler outputs details of your schema (tables, views, procedures, and more) in a diff-able plain-text format (text, CSV, or XHTML). SchemaCrawler can also output data (including CLOBs and BLOBs) in the same plain-text formats. You can use a standard diff program to diff the current output with a reference version of the output.
https://www.SchemaCrawler.com
You will need to provide a JDBC driver for your database.
you don't need any of this stuff.
otn.oracle.com
Oracle has a free tool called SQL Developer. it has a schema diff.
You could use TOAD is a great generic tool for Oracle development. There is a trial version for testing. From the features list:
Another product you could test is OraPowerTools:
As free alternative you could check out this CodeProject article: Schema Compare Tool for Oracle
1: 1: http://www.toadsoft.com/toad_oracle.htm
We use the DKGAS 'DBDiff for Oracle', it can compare an entire schema or part thereof (tables, sequences, indexes, constraints, privileges, packages, objects, and data), as either a comparison report or as an upgrade script.
We use as the latter as the basis for database upgrade scripts.
If you're able to run Perl, you could look at SQLFairy, which should be able to produce a dump of your schema as SQL. YOu can then use standard text diffing tools. There is also a tool which will take two schemas and produce the ALTER commands to make them identical.
If you have some money to spend, consider to use PowerDIFF for Oracle: http://www.orbit-db.com. This tools compares tables, indexes and triggers excellently und comes with a number of comparison options to customize the 'diff' operation. A total difference script (DDL and DML commands) is generated optionally. You need an ODBC driver to connect to the database.