You are here:

Ingres/Compare two tables/sql results from two different databases

Advertisement


Question
Hello Jean-Pierre,

I'm newbie to Ingress and I've come across an interesting assignment in my company.

I need to compare two tables or SQL output of two tables in Ingress DB. These two tables are same tables but on different databases (same schema) and on different machines..

Which means I need to compare the SQL results from the main table with the backup table in Ingress. I know one way to do this is to store the results in two seperate files and then compare these files to find out the difference.

But I could not come across any syntax to store the SQL results in file in Ingress. Please note that these table are huge ones and it may not right to store the entire table in flat/.txt files. so not sure if copydb will work here.

Kindly can I please request you to guide me here. It will be a huge help for me. Thanking you in advance,

with warm regards,
- Avadhut

Answer
Hello,

First, thank you for your interest about Ingres.

Yes copydb can help you in this case. The table volume will impact only on the time to read data and the final file size. This method will work for sure, even if it is not, from a database point of view, the most "elegant".

If your tables are huge, it will possibly preferable to compare them via os command, thru files.

You can use copydb with 2 options in your cases :
-c to unload data in an ASCII format (ie readable by human)
use a vnode to address the remote database (vnode::dbname)

You can also try to create a star database (federate database), and then point to each of your tables. Ingres Star did not care about remote or not cause it always use vnode to adress a database (local or remote). But ... Ingres/Star need some binaries to be installed and configured, and here again I'am not sure, if your tables are huge, the consuming time to compare them will be huge too.

Hope this reply help you. Do not hesitate to ask more if you need some clarifications.

Best regards,
Jean-Pierre ZUATE
http://lafageconseil.fr

Ingres

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jean-Pierre Zuate

Expertise

Any questions about database Ingres (owned by Computer Associates then Ingres Corp) : - Ingres 6.4 - OpenINGRES from 1.0 to 2.0 - IngresII from 2.0 to 2.6 - Ingres R3, Ingres 2006 (Open Source version) - Ingres 9.x, Ingres 10.x - All tool around Ingres : ABF, Report Writer, Replicator, OpenROAD (3.5 to 2006), Ingres/NET Ingres/STAR, ...

Experience

16 years of computing experience as :
- AS400 programmer
- AIX / Ingres administrator and developer (OpenROAD and korn shell)
- Ingres DataBase Administrator
- Ingres expert - Data modelisation - ETL - Reporting - Many of Computer Associates sofwares - ITIL / CMDB / Change Management

Organizations
http://lafageconseil.fr

Education/Credentials
Computing bachelor (1989)

Past/Present Clients
More than 100 customers during my 6 years of CA has an Ingres consultant, all around France and Africa (Togo, Cameroon, Morrocco, ...)

©2012 About.com, a part of The New York Times Company. All rights reserved.