<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Digital Divide &#187; SQL Loader</title>
	<atom:link href="http://www.simonecampora.com/blog/tag/sql-loader/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.simonecampora.com/blog</link>
	<description>Simone Campora&#039;s Blog: about Data Analtsis, GIS, Mobile Apps and more...</description>
	<lastBuildDate>Fri, 05 Aug 2011 07:56:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to efficiently extract and load Tables in Oracle with sqlplus, sqlldr</title>
		<link>http://www.simonecampora.com/blog/2010/07/09/how-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix/</link>
		<comments>http://www.simonecampora.com/blog/2010/07/09/how-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 07:56:18 +0000</pubDate>
		<dc:creator>simonecampora</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dbms]]></category>
		<category><![CDATA[named pipes]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Loader]]></category>
		<category><![CDATA[sqlplus]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.simonecampora.com/blog/?p=202</guid>
		<description><![CDATA[
Today I&#8217;m posting another technical hint for those who might want to extract huge dataset and have to cope with limited disk space issues. SQL Loader is a powerful Oracle tool for bulk loading, and so far the fastest on Oracle.
A major issue is surely the disk space that needs to be occupied while temporarly [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img src="http://nadatest.org/images/SunOracle.png" alt="SUN Oracle" width="304" height="207" /></p>
<p style="text-align: justify;">Today I&#8217;m posting another technical hint for those who might want to extract huge dataset and have to cope with limited disk space issues. SQL Loader is a powerful Oracle tool for bulk loading, and so far the fastest on Oracle.<br />
A major issue is surely the disk space that needs to be occupied while temporarly storing the loading data on local disks. This example will help you overcoming this issue by dumping the data direct on zip files and allowing SQL Loader to read directly from zipped files.</p>
<p>1. Prepare SQL select statement: this is the content inside the  select.sql script</p>
<pre class="brush: sql; collapse: false; light: false; title: ; toolbar: true; notranslate">
set pagesize 0
set head off
set feed off
set line 200

select
col1      || '|' ||
col2      || '|' ||
coln
from
SCHEMA.TABLENAME
;
exit;
</pre>
<p>2. Extract the dataset (for UNIX systems)</p>
<pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
user@machine&gt; mkfifo to-zip
user@machine&gt; gzip -9 -c &lt; to-zip &gt; dataset.dat.gz
user@machine&gt; sqlplus -s username/password@service @select.sql &gt; to-zip
</pre>
<p>3. Create the SQLLDR control file (control.ctl file)</p>
<pre class="brush: sql; collapse: false; light: false; title: ; toolbar: true; notranslate">
LOAD DATA
APPEND
INTO TABLE SCHEMA.TABLENAME
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(
COL1
,COL2
,COLN
)
</pre>
<p>4. Load the dataset</p>
<pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
user@machine&gt; mkfifo unzip
user@machine&gt; zcat dataset.dat.gz &gt; unzip
user@machine&gt; sqlldr userid=$username/$password@$service control=control.ctl log=results.log bad=results.bad discard=results.dsc data=unzip direct=y errors=0
</pre>
<p>And that&#8217;s it! please remember that a good behavior will be always to truncate the table first (if you need to replace the data) and force the rebuild of the table related indexes at the end of the process.</p>
<p><a class="a2a_button_google_bookmarks" href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/google.png" width="16" height="16" alt="Google Bookmarks"/></a><a class="a2a_button_google_buzz" href="http://www.addtoany.com/add_to/google_buzz?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Google Buzz" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/google_buzz.png" width="16" height="16" alt="Google Buzz"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Facebook" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Digg" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_myspace" href="http://www.addtoany.com/add_to/myspace?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="MySpace" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/myspace.png" width="16" height="16" alt="MySpace"/></a><a class="a2a_button_hotmail" href="http://www.addtoany.com/add_to/hotmail?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Hotmail" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/live.png" width="16" height="16" alt="Hotmail"/></a><a class="a2a_button_msdn" href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="MSDN" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/msdn.png" width="16" height="16" alt="MSDN"/></a><a class="a2a_button_wordpress" href="http://www.addtoany.com/add_to/wordpress?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="WordPress" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/wordpress.png" width="16" height="16" alt="WordPress"/></a><a class="a2a_button_orkut" href="http://www.addtoany.com/add_to/orkut?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Orkut" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/orkut.png" width="16" height="16" alt="Orkut"/></a><a class="a2a_button_yahoo_bookmarks" href="http://www.addtoany.com/add_to/yahoo_bookmarks?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Yahoo Bookmarks" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/yahoo.png" width="16" height="16" alt="Yahoo Bookmarks"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_technorati_favorites" href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;linkname=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://www.simonecampora.com/blog/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.simonecampora.com%2Fblog%2F2010%2F07%2F09%2Fhow-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix%2F&amp;title=How%20to%20efficiently%20extract%20and%20load%20Tables%20in%20Oracle%20with%20sqlplus%2C%20sqlldr" id="wpa2a_2">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.simonecampora.com/blog/2010/07/09/how-to-extract-and-load-a-whole-table-in-oracle-using-sqlplus-sqlldr-named-pipes-and-zipped-dumps-on-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

