Oracle to SQL data migration is taking too much time | Need Help

Mohsin M Patel 0 Reputation points
2024-07-06T04:43:31.4+00:00

Hello Experts,

We need your help to minimize time for data migration from Oracle to SQL.

Example, there exist a table in Oracle with 100 Million records and its been three days and session is still executing in SQL server

What we have done ?

  1. Created a linked server to Oracle
  2. Used openquery to insert records to SQL table

Kindly advise, what can be the best option to deal with this case. Many thanks in advance !

Regards,

Mohsin/Naren

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,368 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 107.2K Reputation points
    2024-07-06T08:31:07.8633333+00:00

    And how does that query look like? Are you trying to insert all those 100 million rows in one statement?

    When you are trying to copy that much data it is imperative that you do it in batches. So if you want to do it with OPENQUERY, take like five million rows at a time. Define your batches in such a way that there is an index to follow on the Oracle side. Or, well, hm, for SQL Server the best is to use a clustered index, but clustered indexes are not very hip on the Oracle side. But maybe Oracle permits you to read by row id or something like that? In any case, you don't want a scan for each batch.

    But I would also look into export all to files and import them to SQL Server with BCP or BULK INSERT. Both these permits you to set a batch size, so that there is a commit after each five million rows or whatever.


  2. Olaf Helper 43,331 Reputation points
    2024-07-08T06:58:15.52+00:00