Showing posts with label databases. Show all posts
Showing posts with label databases. Show all posts

Thursday, March 26, 2009

Comparing two different Databases

This is a tiny tool which would come handy in case you need to compare two different tables/ databases on same or different servers. I came across this unique requirement when we had to come up with a small code which would return TRUE or FALSE based on equal or unequal tables. I googled a bit and cam eup with the following code.

The code takes input from xml file. stored at disk. The code also compares SQL table with Oracle Table which is normally not provided by most DB compare tools available for free.

Mail me in case you have any issues using the tool.
Following is the snippet of xml file:








Tuesday, November 25, 2008

Creating two databases in sync...

We had this unique requirement of having two different tables in two different databases on two different DB servers in sync. (Too many differences huh...)
We created the same in a span of 2 days starting from scratch. We started with creating local triggers for Insert, Update and Delete which would dump the INSERTED / DELETED data in a temporary physical table on same DB server. Then we created stored procedures which would pull data from the remote temporary table and dump the same in local table. (Not the local temporary table.).

We used the Managed Application feature in SQL Server 2005 to run the stored procedure after a fixed interval of time. We did this to avoid updating data on remote Database directly using triggers.

Last but not the least the databases remain out of sync for the time indicated in Managed Application.