Compare column for different tables on the same database.

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

    I will introduce you how to compare structure for different tables in the same database (HOST type) with the compare any column utility (Overview / Download). I create the three tables in SH schema for this demo.

create table SALES_CHINA (COL1 NUMBER(10));
create table SALES_US (COL1 NUMBER(10),COL2 NUMBER(15,2));
create table SALES_OTHER (
   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.

HOST: sh/sh@db10g | SALES_CHINA, SALES_US, SALES_OTHER

    Now we can run this utility with the following command.

companycol.pl -f host_demo.cfg

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

Comparing structure on HOST sh@db10g...
Tables:
       SALES_CHINA      SALES_US        SALES_OTHER
     [MISSING ] COL2 :
               SALES_CHINA
     [MISSING ] COL3 :
               SALES_CHINA      SALES_US

    Is it simple and powerful?

Post a comment

« Previous | Main | Next »

Powered by
Movable Type 3.36