Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Joseph.

Asked: August 14, 2017 - 10:34 pm UTC

Last updated: August 16, 2017 - 1:01 pm UTC

Version: oracle 11g

Viewed 1000+ times

You Asked

My Question: What might I expect from loading 750,000 rows with SQL*Loader. Via ODBC (INSERT INTO) it is 2.6 hours.


Detail -------------------

I am loading Data into an oracle table from Spreadsheet, import to MS Access, prepare the table with an update or two, and then INSERT INTO a oracle tables via ODBC.
We have about 10 spreadsheets to load. Once the data is in Oracle tables, we can do some very fast "processing" via MS Access Pass through queries.
They work great. It is very fast.

The issue is the speed when loading "prepared" MS Access tables to Oracle.

For our larger tables 300,000 row to 750,000 rows, we get about 80 rows per second, MS ACCESS to ODBC linked oracle table.
My thought is to Convert the MS ACCESS back to .csv or .txt (without headers) and use the SQL*Loader.
I understand the CONTROL file and can build that accordingly.

Rather than getting too far ahead, there an general indication that SQL Loader would process the (spreadsheet.csv) considerably faster.
I understand also that we can RUN Sql*Loader with the CONTROL FILE like a "batch-file" from MS ACCESS (vba)...so that should be no problem to construct the Control file and execute the batch as part of the current "load" procedure.

The question is speed. I have not used SQL * Loader so I cannot sing its praises, yet. But I sense this might be a good step forward

My Question (once again) : What might I expect from loading 750,000 rows with SQL*Loader. Via ODBC it is 2.6 hours.

Thanks.

Joseph Giallombardo




and Connor said...

Well...lets give it a test and see how we go.

Here's my table and my control file

SQL> create table emp  as
  2  select * from scott.emp
  3  where 1=0;

Table created.

SQL> desc emp
 Name                          Null?    Type
 ----------------------------- -------- --------------------
 EMPNO                         NOT NULL NUMBER(4)
 ENAME                                  VARCHAR2(10)
 JOB                                    VARCHAR2(9)
 MGR                                    NUMBER(4)
 HIREDATE                               DATE
 SAL                                    NUMBER(7,2)
 COMM                                   NUMBER(7,2)
 DEPTNO                                 NUMBER(2)

C:\temp>cat scott.ctl
LOAD DATA
INFILE "c:\temp\scott.dat"
INTO TABLE emp
REPLACE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(
empno
,ename
,job
,mgr
,hiredate
,sal
,comm
,deptno
)



and I've got a file c:\temp\scott.dat with some sample data in there to load. Let's put it in with SQL Loader

C:\temp>sqlldr userid=mcdonac control=scott.ctl direct=true 
Password: ********

SQL*Loader: Release 12.2.0.1.0 - Production on Tue Aug 15 12:07:34 2017

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

Path used:      Direct

Load completed - logical record count 11413668.

Table EMP:
  11413668 Rows successfully loaded.

Check the log file:
  scott.log
for more information about the load.

C:\temp>grep Elap scott.log
Elapsed time was:     00:00:14.67


Yep...that's 11.5 million rows in 14 seconds. You might be wondering what high powered server I ran this on ? My laptop :-)


Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

SQL * Loader

Joseph Giallombardo, August 15, 2017 - 2:43 pm UTC

Wow! I thought it would be fast...But that's phenomenal. Exactly what we want to do..
Connor McDonald
August 16, 2017 - 1:01 pm UTC

The database is pretty quick when used well :-)

More to Explore

Utilities

All of the database utilities are explained in the Utilities guide.