05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 15<br />

■ ■ ■<br />

Data Loading <strong>and</strong> Unloading<br />

In this chapter, we will discuss data loading <strong>and</strong> unloading—in other words, how to get data<br />

into <strong>and</strong> out of an <strong>Oracle</strong> database. The main focus of the chapter is on the following bulk data<br />

loading tools:<br />

• SQL*Loader (pronounced “sequel loader”): This is still a predominant method for loading<br />

data.<br />

• External tables: This is a new feature with <strong>Oracle</strong>9i <strong>and</strong> above that permits access to<br />

operating system files as if they were database tables <strong>and</strong>, in <strong>Oracle</strong> 10g <strong>and</strong> above,<br />

even allows for the creation of operating system files as extracts of tables.<br />

In the area of data unloading, we’ll look at two techniques:<br />

• Flat file unload: The flat file unloads will be custom developed implementations,<br />

but will provide you with a result that is portable to other types of systems (even a<br />

spreadsheet).<br />

• Data Pump unload: Data Pump is a binary format proprietary to <strong>Oracle</strong> <strong>and</strong> is<br />

accessible via the Data Pump tool <strong>and</strong> external tables.<br />

SQL*Loader<br />

SQL*Loader (SQLLDR) is <strong>Oracle</strong>’s high-speed, bulk data loader. It is an extremely useful<br />

tool used to get data into an <strong>Oracle</strong> database from a variety of flat file formats. SQLLDR can<br />

be used to load enormous amounts of data in an amazingly short period of time. It has two<br />

modes of operation:<br />

• Conventional path: SQLLDR will employ SQL inserts on our behalf to load data.<br />

• Direct path: SQLLDR does not use SQL in this mode; it formats database blocks directly.<br />

The direct path load allows you to read data from a flat file <strong>and</strong> write it directly to formatted<br />

database blocks, bypassing the entire SQL engine, undo generation <strong>and</strong>, optionally, redo<br />

generation at the same time. Parallel direct path load is among the fastest ways to go from<br />

having no data to a fully loaded database.<br />

We will not cover every single aspect of SQLLDR. For all of the details, refer to the <strong>Oracle</strong><br />

Utilities manual, which dedicates seven chapters to SQLLDR in <strong>Oracle</strong> 10g. The fact that it is<br />

649

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!