Solved

insert data into a sql server database from an oracle linked server

Posted on 2014-02-08
14
1,487 Views
Last Modified: 2014-03-28
Hello,

I want to insert data into a sql server database from an oracle linked server.
How can I query to retrieve only new records?

I use this query for select tables but how can I modify it for insert into SQL SERVER tables and only the new rows :
SELECT * FROM OPENQUERY(ORACLE_BKP, 'SELECT * FROM ORACLE.USR')

Thanks
0
Comment
Question by:bibi92
[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
  • 6
  • 5
14 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39844587
What defines 'new' records?

Is there a date of some type in the Oracle table?

What happens if a record is updated or deleted in the Oracle table?

I would look at creating a table that tracks changes on the main table.  Then you know what rows have been added/changed or deleted.


Sounds like you want to replicate across the two systems.

I've never used this product but it is supposed to be able to do this:
http://www.oracle.com/technetwork/articles/datawarehouse/oracle-sqlserver-goldengate-460262.html
0
 

Author Comment

by:bibi92
ID: 39844605
Hello,
Thanks, but Oracle GoldenGate need license, I can't use it.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39844619
What about my other questions?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:bibi92
ID: 39844744
I want to replicate across the two systems.

Thanks
0
 
LVL 35

Expert Comment

by:johnsone
ID: 39845246
One other way that is a lot less efficient and will not work if the amount of records is going to grow, but it is a quick and dirty solution.

Within a transaction, delete all the records in the table and then insert all the records from Oracle.

I have done it that way in the past, but only for small tables.  If there is a large amount of data, then copying that much across the wire every time is going to be pretty slow.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39845995
>>I want to replicate across the two systems.

I meant what about the answers to my other questions:
What defines 'new' records?
Is there a date of some type in the Oracle table?
What happens if a record is updated or deleted in the Oracle table?


That post also brings up a new question:
Are you looking to replicate both ways?
0
 

Author Comment

by:bibi92
ID: 39849977
I have migrated the tables with SSMA.
If a record is updated or deleted in the oracle table, it has to been updated or deleted in the sql server table.
No only from oracle to sql server.
Thanks
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39850041
Without some 3rd party app I don't know of a way to replicate from Oracle to SQL Server.

If you are wanting to write your own, I would look at a trigger on the Oracle side to track what changes need to be propagated to SQL Server then set up a job to perform the changes.

You might be able to do it with queuing but I don't know if SQL Server can be set up to receive messages from an Oracle queue.
0
 

Author Comment

by:bibi92
ID: 39892741
I've requested that this question be closed as follows:

Accepted answer: 0 points for bibi92's comment #a39849977

for the following reason:

I have not found another solution.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39892742
I have a feeling you are trying to close this to avoid the new question lock and your new question seems to prove that.


Given your reason of "I have not found another solution."

I feel that I have to object you accepting your own post as the answer to this question.

I provided an answer that you said you could not use since you had no money.

You have not found an answer because I do not believe a 'free' solution exists.
0
 

Accepted Solution

by:
bibi92 earned 0 total points
ID: 39942147
Hello,

I have found another solution, create a Microsoft SSIS Package.

Thanks
0
 

Author Closing Comment

by:bibi92
ID: 39961049
Hello,

I have to create mssql job for refresh data and I use SSIS for transfer data between Oracle and SQL SERVER
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

738 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