Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to reflect changes in Oracle db tables into SQL Server db? Expand / Collapse
Author
Message
Posted Tuesday, July 15, 2014 7:31 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 1:33 AM
Points: 14, Visits: 118
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
Post #1592554
Posted Tuesday, July 15, 2014 7:57 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:50 AM
Points: 4,986, Visits: 11,684
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?



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1592577
Posted Tuesday, July 15, 2014 8:16 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 1:33 AM
Points: 14, Visits: 118
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
Post #1592594
Posted Tuesday, July 15, 2014 8:45 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:50 AM
Points: 4,986, Visits: 11,684
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



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1592621
Posted Tuesday, July 15, 2014 9:15 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 1:33 AM
Points: 14, Visits: 118
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!

Post #1592644
Posted Tuesday, July 15, 2014 9:31 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:50 AM
Points: 4,986, Visits: 11,684
No problem and good luck. Why not use SSIS all the time? It's a perfect scenario for it.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1592650
Posted Wednesday, July 16, 2014 5:05 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 1:33 AM
Points: 14, Visits: 118
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.
Post #1592994
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse