Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

US Census CSV data to DB12c SQL*Loader

$
0
0

Do you know that DB12c sqlldr is a little smarter...finally ? Now, *.ctl file is not always necessary.

SQL*Loader Express

In express mode, a SQL*Loader control file is not used.

So I did a small experiment.
Here's US Census Bureau data in csv format.

As is often the case, 1st line describes data content and real data begins from 2nd line.
One can pass the 1st line to sqlplus and all the rest to sqldr in 1 pass.
And sqlldr can read from standard input for over many releases.
So, here's my quick&dirty one liner.

$curl --silent  --proxy your_proxy:8888 \>'http://www.census.gov/popest/data/state/asrh/2013/files/SCPRC-EST2013-18+POP-RES.csv' |>(   \>  read line;echo $line |>  sed 's/^/CREATE TABLE OVER18POP (/;s/,/ varchar2(32),/g;s/$/ varchar2(32));/' |>  sqlplus scott/tiger;  \>  sqlldr scott/tiger table=OVER18POP data=\'-\'  \>)

SQL*Plus: Release 12.1.0.1.0 Production on Thu Jan 9 15:54:05 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Last Successful login time: Thu Jan 09 2014 15:49:02 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>
Table created.

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL*Loader: Release 12.1.0.1.0 - Production on Thu Jan 9 15:54:06 2014

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

Express Mode Load, Table: OVER18POP
Path used:      External Table, DEGREE_OF_PARALLELISM=AUTO
SQL*Loader-816: error creating temporary directory object SYS_SQLLDR_XT_TMPDIR_00000 for file -.dat
ORA-01031: insufficient privileges
SQL*Loader-579: switching to direct path for the load
SQL*Loader-583: ignoring trim setting with direct path, using value of LDRTRIM
SQL*Loader-584: ignoring DEGREE_OF_PARALLELISM setting with direct path, using value of NONE
Express Mode Load, Table: OVER18POP
Path used:      Direct

Load completed - logical record count 53.

Table OVER18POP:
  53 Rows successfully loaded.

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

Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>