Link to home
Start Free TrialLog in
Avatar of chaitu chaitu
chaitu chaituFlag for India

asked on

how to write batch file to compare two schemas

how can i compare two DB schemas using batch file or shell script .I can use tools like TOAD or PL/SQL devloper to compare two schemas but there is a restriction that i can't use these tools.
if i need to compare two schemas say A and B then it should  generate a log file which describes what tables,views and procedures are changed.
Avatar of OMC2000
OMC2000
Flag of Russian Federation image

I would get a list of all Oracle views, which represent schema objects using query like the following:
select * from all_views
where view_name like 'ALL%';

then for all views, which represent objects present in my schemas make select statements like the following:

select * from all_indexes
where owner in ('SCHEMA1','SCHEMA2')
order by index_name;

The result of all such statements should give you representation of all schema objects compared one by one.
You certainly could build more complicated logic in order to indicate missed objects in the schemas
Avatar of Sean Stuber
Sean Stuber



use dba_objects to iterate through all objects owned by the two schemas and dbms_metadata.get_ddl to get the descriptions of each and then compare
ASKER CERTIFIED SOLUTION
Avatar of sventhan
sventhan
Flag of United States of America 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
Avatar of chaitu chaitu

ASKER

Thanks