Compare column for the same table on different databases.

Links: http://www.dbatools.net/mytools/compare_column_table_type.html

    I will introduce you how to compare structure for the same table in different database (TABLE type) with the compare any column utility (Overview / Download). I create the "SALES" table in three different databases for this demo.

-- dbchina
CREATE TABLE SALES (COL1 NUMBER(10), COL2 NUMBER(12,2));
-- dbus
CREATE TABLE SALES (COL1 NUMBER(10), COL2 NUMBER(15,2));
-- dbother
CREATE TABLE SALES (
    COL1 NUMBER(10), COL2 NUMBER(15,2), COL3 DATE);

    Then we need to write a configuration file, to tell this utility which tables are compared togather.

TABLE: sh@dbchina, sh@dbus, sh@dbother | SALES

    Now we can run this utility with the following command.

companycol.pl -f table_demo.cfg

    Then check the screen output or check the log file generated (with "-l" option).

Comparing structure by TABLE SALES ...
     [MISMATCH] COL2 NUMBER(12,2) :
                       sh@dbchina
     [MISMATCH] COL2 NUMBER(15,2) :
                       sh@dbus         sh@dbother
     [MISSING ] COL3 :
               sh@dbchina       sh@dbus

    Is it simple and powerful? This is the compare type we mostly used.

Post a comment

« Previous | Main | Next »

Powered by
Movable Type 3.36