Skip to Main Content
  • Questions
  • can SQL loader read from zipped file .gz as input/data ?

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Ahmed.

Asked: April 08, 2017 - 7:39 am UTC

Last updated: April 09, 2017 - 8:54 am UTC

Version: 10

Viewed 1000+ times

You Asked

im using SQL loader on unix solaries

i have a file.txt like below which can use it normally as input / data file
my problem is i need to use the file in .gz stat for desk space issues
i've tried the below example as test & it fails, i need to find any way to read from gz file as input instant of extracting the file & delete it later .



cat file.txt
123,123,123
123,123,123
123,123,123

sqlldr userid=x/x@x control=x.ctl data=file.txt ( work perfectly )



gzcat file.txt.gz
123,123,123
123,123,123
123,123,123

gzcat file.txt.gz | sqlldr userid=x/x@x control=x.ctl ( didnt work )

and Connor said...

If you are on Unix, you can use a named pipe for this, eg

mknod named_pipe.dat p
gzip -dc myfile.gz > named_pipe.dat &
sqlldr control=x.ctl

where x.ctl uses "named_pipe.dat" as the source data

So the file is decompressed on the fly as an input into sqlldr without ever being fully decompressed on disk

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