Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> synchronization with heterogeneous tables and referential integrity

synchronization with heterogeneous tables and referential integrity

From: Cris Carampa <cris119_at_operamail.com>
Date: Fri, 21 Oct 2005 11:33:42 +0200
Message-ID: <4358b61c$0$8496$5fc30a8@news.tiscali.it>


I am developing an Oracle-based application (10.1 or 10.2, SE1, Linux) for a company which has an accounting system based on a SQLServer2000 database.

In my application's database design there are entities which have foreign keys referenced to some tables that should be maintained by the accounting application in SQLServer.

My idea is to build "shadow" tables in Oracle with the same structure of the SQLServer tables and implement a scheduled batch process that keep them synchronized with SQLServer using a database link and Heterogeneus Services.

My question is about which method to use to make the synchronization. I am looking at the following solutions:

  1. implement the SQLServer "shadow" tables with Materialized Views. Unfortunately, I noticed that you can't have a foreign key on a "real" table referenced to a MV, so with this solution I would lose Referential Integrity or at least I should try to keep it with triggers. This seem a Bad Thing (TM) to me.
  2. implement the SQLServer "shadow" tables with real Oracle tables and tell the batch process to disable all the foreign keys, drop the "shadow" tables, recreate them with CTAS and enable all foreign keys again. The problem is that a deletion of a SQLServer row that has Oracle children would stop the CTAS statement and the table would not be rebuilt.
  3. using a MERGE statement in the batch process for inserting new rows and update changed rows in the "shadow" tables based upon the fact that primary keys in SQLServer and in Oracle are the same. A second statement could delete the rows that were deleted in SQLServer and that have no childs in Oracle.

Every kind of suggestion is welcome. Kind regards,

-- 
Cris Carampa (cris119_at_operamail.com)
Studente fuori corso di Oftalmologia fastrica
Facoltà di Irrilevanza Comparata
Received on Fri Oct 21 2005 - 04:33:42 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US