?
Solved

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

Posted on 2014-02-08
14
Medium Priority
?
1,559 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
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

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.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

771 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