Solved

SSIS Lookup Two Different Databases to Build

Posted on 2010-11-19
3
492 Views
Last Modified: 2012-05-10
I am building a data warehouse with sales in my SQL Server 2008 database.  I am feeding it with information from an Oracle 9 ERP system.  I am using SSIS to do the ETL.

I would like the best strategy to approach a particular ETL problem I have to build Daily Sales.
The SQL Server destination Sales table is called tblSales.  Every day I must add in the new Sales that have been generated for the previous day from the Oracle system.  It is possible, however, for a Sale to 'drop in' from weeks ago which has been in some form of query state with the Finance department.  There are no date flags to say when this occurs otherwise I could just look to see which recent Sales had dropped in and this would include the recent Sales.  I wouldn't really have a problem as I would just fire one query over to get all of those Sales.  
Long story short, I have a table of the unique TransactionNo / StoreNo combinations in both SQL Server and Oracle and created the table tblDifferentialSales.  This has all of the Sales that need to be transferred across.

My problem is that the method I am using in SSIS, although it works, is very slow (about 1 second per Transaction – there could be 20,000 transactions per day to import).  

Current Method:

1. Execute SQL Task to
select StoreNo, TransactionNo from tblDifferentialSales
this is outputs to an object Variable

2. For Loop Container, loops the object Variable in a Data Flow Task and creates the specific SQL to draw back one Sale Transaction in a Text Variable, txtSQL, which is then assigned to the [ADO NET Source].[SQLCommand].  

3. This is then output to the tblSales OLE DB destination.

I wondered if it is possible to use something like the ‘Merge Join’ Transformation to get the Oracle dataset to read from the SQL server dataset as its criteria.  I have tried to make this work but I am using both ADO and an OLE connections for different databases (mainly because the SQLCommand property seems to be more easily exposed than for an OLE connection).  I can find examples for Merge Joins but not with two different databases.  Bear in mind that the SQL Server connection may have 20,000 records in it but the Oracle ERP connection may have millions to join with.
I am open to any possibilities.  What is the best way to go about this, please?  Has anyone done something like this before?

0
Comment
Question by:DATABAS3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Expert Comment

by:rmm2001
ID: 34177500
I'd stay away from doing the merge join. If you're in ssis 2008, cache the ids you have in sql server using a cache transformation (I'd put it to a file). Then make a data flow task. The source of the dataflow task will be the data from your oracle table. Then add a lookup transformation with the connection being your cache connection manager you just made from the sql ids. Map the columns accordingly. Send the "no match rows" to a multicast. On one side insert the data from the oracle table into your sql table. On the other side, insert the new ids into your sql id table and you should be updated and good to go!
0
 

Accepted Solution

by:
DATABAS3 earned 0 total points
ID: 34217655
I have done this but it doesn't seem to give me any greater speed.  It may be that I had the right idea originally (which when building from oracle to oracle in a cursor flies in a couple of minutes).

It may be the connection that is letting me down, rather than the loop.  The loop may be slowed by an overhead on the insert in Oracle (?).

Thanks for your idea - it was useful to learn a new way to do it but overall, the time still takes to long.  I am having to build in Oracle for speed and than import to SQL Server.  This is not ideal as it introduces another failover point.
0
 

Author Closing Comment

by:DATABAS3
ID: 36935095
I didn't really get enough options to look at this in any great detail.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question