chaitu chaitu
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.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
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