Solved

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

Posted on 2014-02-08
14
1,383 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)
Comment Utility
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
Comment Utility
Hello,
Thanks, but Oracle GoldenGate need license, I can't use it.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
What about my other questions?
0
 

Author Comment

by:bibi92
Comment Utility
I want to replicate across the two systems.

Thanks
0
 
LVL 34

Expert Comment

by:johnsone
Comment Utility
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)
Comment Utility
>>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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:bibi92
Comment Utility
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)
Comment Utility
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
Comment Utility
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)
Comment Utility
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
Comment Utility
Hello,

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

Thanks
0
 

Author Closing Comment

by:bibi92
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

772 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

12 Experts available now in Live!

Get 1:1 Help Now