How to reflect changes in Oracle db tables into SQL Server db?

  • Hi,

    Is there a way to just import changes to tables in a live (Oracle 11g) database into SQL Server, rather than importing the whole table and rebuilding each time?

    I have a SS2012 db that uses SSIS to import data from an Oracle 11g db. Currently this process is run once a day and truncates and repopulates each table completely.

    My objective is to only import new or modified data from the target tables each time the SSIS package runs. The overall goal is to be able to run this SSIS job many times during the working day to enable me to have a close-to-live db for reporting.

    Is this possible? If so what would be the best course of action?

    As ever any help hugely appreciated.

    thanks

    Lins

  • lindsayscott23 (7/15/2014)


    Hi,

    Is there a way to just import changes to tables in a live (Oracle 11g) database into SQL Server, rather than importing the whole table and rebuilding each time?

    I have a SS2012 db that uses SSIS to import data from an Oracle 11g db. Currently this process is run once a day and truncates and repopulates each table completely.

    My objective is to only import new or modified data from the target tables each time the SSIS package runs. The overall goal is to be able to run this SSIS job many times during the working day to enable me to have a close-to-live db for reporting.

    Is this possible? If so what would be the best course of action?

    As ever any help hugely appreciated.

    thanks

    Lins

    Do the source tables have date created/date modified columns?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Hi Phil

    I just had a look at some of the key ones and they do yes.

    The PL/SQL datatype is datetime2, but it looks as thought the time isn't captured...

    thanks

    Lins

  • Well that's a good start. Here's a pattern that could be worth investigating. Pseudo-code: for each table t:

    1) truncate target.wrk.t

    (a work table - truncated every run, same columns/constraints as the main target table t)

    2) select @MaxDate = max(dateCreated, DateModified) from target.dbo.t

    3) insert target.wrk.t

    select [columns] from source.dbo.t

    where max(dateCreated, DateModified) >= @MaxDate

    4) merge target.wrk.t into target.dbo.t

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • yes, that makes sense. I can visualise how that could work and it strikes me that I could use the SSIS packages for an initial load and then use OPENQUERY to the live oracle db to pick up changes thorughout the day.

    I'll experiment with a couple of tables now.

    thanks lots!

  • No problem and good luck. Why not use SSIS all the time? It's a perfect scenario for it.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • After trying a test OpenQuery on a table and seeing how slowly it ran, that's definitely my plan!

    I think I'll have a daily rebuild and then build packages to run throughout the moving over the updates and changes.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply