I will introduce the third compare column method to you. I want to compare the table "EMP_BAK" on database "prod" with table "EMP" on database "TEST". As business required, we need these two tables on different databases to be consistent. I create a configuration as following :
ALL: -
EMP_BAK!anysql/anysql@prod | -
EMP!scott/tiger@test
The minus operation means continue to next line. Now run the following command :
compare_column.pl -f test.cfg
I get the following output on screen :
Comparing structure of tables on different hosts ...
Tables
emp_bak EMP
[MISMATCH] ENAME VARCHAR2(20) :
EMP!test
[MISMATCH] ENAME VARCHAR2(10) :
emp_bak!prod
[MISSING ] COL_PROD :
EMP!test
[MISSING ] COL_TEST :
emp_bak!prod
You can see that the tables "EMP" and "EMP_BAK" are in inconsistent state. The is one column ("ENAME" column) type mismatch, and one column ("COL_PROD") is missing on test database (table : "EMP"), and one column ("COL_TEST") missing on production database (table : "EMP_BAK").
By this utility, I identified out a lot of inconsistent tables in our system, and got very good feedbacks from my leaders.