SQL*LOADER
Defination:
1)
SQL*Loader loads data from external files into tables of an Oracle database.
2)
The control file is a text file written in a language that SQL*Loader understands
.
3)
The SQL*Loader Control File
The SQL*Loader control file is a repository that contains the DDL instructions thatyou have created to control where SQL*Loader will find the data to load, how SQL*Loader expects thatdata to be formatted, how SQL*Loader will be configured (memory management, rejecting records,interrupted load handling, and so on) as it loads the data, and how it will manipulate the data beingloaded. You create the SQL*Loader control file and its contents using a simple text editor such as vi or xemacs.
Description:
SQL*Loader takes as input a control file, which controls the behavior of SQL*Loader,and one or more datafiles. The output of SQL*Loader is an Oracle database (where the data is loaded), alog file, a bad file, and potentially, a discard file.You use SQL*Loader's data definition language (DDL) tocontrol how SQL*Loader performs a data load into your database. You can also use DDL to manipulate thedata you are loading.The control file describes the task that SQL*Loader is to carry out. The control file tells SQL*Loader where to find the data, how to parse and interpret the data, where to insert the data, and more.The controlfile has three sections
a) The first section contains session-wide information,for example:Global options such as bindsize, rows, records to skip, and so on INFILE clauses to specifywhere the input data is located Data character set specification
b)The second section consists of one or more "INTO TABLE" blocks. Each of these blocks containsinformation about the table into which the data is to be loaded, such as the table name and thecolumns of the table.
c)The third section is optional and, if present, contains input data.Note that the optional thirdsection of the control file is interpreted as data rather than as control file syntax;consequently,comments in this section are not supported.The other input to SQL*Loader, other than the control file, is the data.SQL*Loader's perspective,the data in the datafile is organized as records. A particular datafile can be in fixed record format,variable record format, or stream record format. Important: If data is specified inside the controlfile(that is, INFILE * was specified in the control file), then the data is interpreted in the streamrecordformat with the default record terminator.
Fixed Record Format:
When all records in a datafile are the same byte length, the file is infixed record format. Although this format is the least flexible, it does result in better performancethan variable or stream format. Fixed format is also simple to specify.
Loading Data in Fixed Record Format
load datainfile 'example.dat' "fix 11"into table examplefields terminated by ',' optionally enclosed by '"'(col1 char(5),col2 char(7))
Add a Comment