Solved

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

Posted on 2014-02-08
14
1,480 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

756 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