SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
lindsayscott23
lindsayscott23
Mr or Mrs. 500
Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)

Group: General Forum Members
Points: 588 Visits: 493
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
Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)

Group: General Forum Members
Points: 52988 Visits: 21195
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
lindsayscott23
lindsayscott23
Mr or Mrs. 500
Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)

Group: General Forum Members
Points: 588 Visits: 493
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
Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)

Group: General Forum Members
Points: 52988 Visits: 21195
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
lindsayscott23
lindsayscott23
Mr or Mrs. 500
Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)

Group: General Forum Members
Points: 588 Visits: 493
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!
Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)

Group: General Forum Members
Points: 52988 Visits: 21195
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
lindsayscott23
lindsayscott23
Mr or Mrs. 500
Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)Mr or Mrs. 500 (588 reputation)

Group: General Forum Members
Points: 588 Visits: 493
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search