Solved

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

Posted on 2014-02-08
14
1,402 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
  • 6
  • 5
14 Comments
 
LVL 76

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 76

Expert Comment

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

Author Comment

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

Thanks
0
 
LVL 34

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 76

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 76

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 76

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now