160 likes | 273 Views
Index. What is DBCompare ? Why we need DBCompare ? How to use it ? Summary. What is DBCompare ?. It is a tool to keep two (or more) databases in synch.
E N D
Index • What is DBCompare ? • Why we need DBCompare ? • How to use it ? • Summary
What is DBCompare ? • It is a tool to keep two (or more) databases in synch. • To achieve that one can run this tool by providing the schema details and it generates the user friendly reports about the differences in databases. • It also generates the alter script which can be applied in other database to clear out the differences. • It covers almost all of the database objects e.g. Tables, Stored Procedures, Indexes.
Why we need it ? • In our daily life, software developers faces a lot of issues due to differences in the databases in different environments e.g. one application running fine in dev. environment might be failing in QA environment for just a simple reason that either some table is not present or some column is missing or in fact column length in QA environment is not same as in dev. environments. • It takes effort and manpower to identify those kind of issues which can be time consuming at sometime. This tool comes handy at that time and within minutes* it would generate the report and script for you to apply and remove those differences. • (*) – Run time takes the connection speed and database size.
How to use DBCompare ? Brief: This project takes properties of two databases(need to synchronize ) as its inputs and generates different types of user friendly reports. Details: Lets have two databases, SCHEMA_1 SCHEMA_2 NOTE: You can make any one database as reference. In this example we are taking SCHEMA_1 as reference.
DataBase Schema Details Department Table not present Extra column Has 2 foreign keys Size 20 Byte Age column absent SCHEMA_1 SCHEMA_2
Index Details…. • There is a index on each schema with name DEPARTMENT_EMPLOYEE. • Index in SCHEMA_1 • Index in SCHEMA_2
Procedures Details…. create or replace procedure "SP_INSERT_EMPLOYEEDETAILS" ( id IN VARCHAR2, name IN VARCHAR2, role IN VARCHAR2, department IN VARCHAR2, age IN VARCHAR2 ) is begin insert into EMPLOYEE values(ID, Name); insert into REGISTER values(Name,role,DEPARTMENT,AGE); end; create or replace procedure "SP_INSERT_EMPLOYEEDETAILS" ( id IN VARCHAR2, name IN VARCHAR2, role IN VARCHAR2, department IN VARCHAR2 ) is begin insert into EMPLOYEE values(ID, Name); insert into REGISTER values(Name,role,DEPARTMENT); end; SCHEMA_1 SCHEMA_2
Report’s Phases Reports has two phases. • First give details on both schemas as well as differences between them. 2. Second phase provide you a script to synchronize the database.
….report’s phase…(1st phase) By exploring the reports you can find details of various components(tables , indexes , procedures , e.t.c.).
….report’s phase…(1st phase) Table’s Difference Report:
….reports Same way you can find other reports (table indexes List, table structure, etc.) just by navigating through the report directories of two different schemas (SCHEMA_1 and SCHEMA_2). Here we are attaching the some report files for your reference. 1. Table Indexes List for SCHEMA_1: 2. Table Structure for SCHEMA_1 : 3. Table Indexes List for SCHEMA_2: 4. Table Structure for SCHEMA_2 :
Report Phase 2 DBCompare not only tell you about the differences in schema, but also it provides you a script to synchronize your databases.
Summary. This is a wonderful tool to keep databases in synch in terms of DB structure. It’s a light weight tool and currently supports Oracle database, but could be easily extend to support any other database e.g. MySQL, Sybase etc.