Page 373
You must drop indexes and disable primary key constraints and unique key constraints on the table before doing a parallel load. Oracle version 7.1 introduced parallel index creation, but you may use it only with a CREATE INDEX statement, not within an ALTER TABLE CREATE CONSTRAINT statement. Therefore, the best method is to create the indexes first, using the parallel option, and then create the primary key and unique constraints, which use the previously created indexes.
NOTE |
Parallel SQL*Loader sessions that are interrupted normally (for example, by a Ctrl+C in UNIX) terminate normally; they stop processing where they were interrupted . Any temporary segments created during the session are added to the table's high water mark. Any parallel session that was " killed " from an O/S command terminates abnormally; the temporary segments are dropped and not added to the table's high water mark. |
TIP |
If you are creating a large table (which you know will be populated by the parallel option of SQL*Loader), first create a striped tablespace to hold the table, equally sizing the data files that comprise the tablespace across multiple devices. Next, create the table with the |
Page 374
continued |
The control file is in free format; it does, however, have a few rules:
TIP |
It is generally good practice not to use Oracle reserved words for any database object names. I have seen numerous cases in which Oracle got confused when reserved words were used as database object names. (The error messages are ambiguous.) For the complete lists of reserved words for SQL*Loader, SQL*DBA, and Oracle, refer to the Oracle8 Server Utilities Guide and the SQL Language Reference Manual. |
Page 375
The control file is logically organized into seven sections:
Listings 16.1, 16.2, and 16.3 help illustrate some of the syntax described in this section.
Listing 16.1 is a sample control file for a direct path parallel load using a fixed-format input file. This control file was used to test SQL*Loader results using the direct path parallel option in an unrecoverable mode. For illustration purposes only, the SQL*Loader functions CONSTANT, SEQUENCE, SYSDATE , and RECNUM were used to populate column data.
Listing 16.1. Parallel load control file.
OPTIONS (direct=true, parallel=true) UNRECOVERABLE LOAD DATA INFILE'/data01/ORACLE/TEST/fixed_data.dat' BADFILE'fixed_data.bad' DISCARDFILE'fixed_data.dis' INSERT INTO TABLE loader_test OPTIONS (FILE='data02/ORACLE/TEST/test1_TEST_01.dbf') (loader_constant CONSTANT "A" loader_sequence sequence (1,1), loader_sysdate sysdate, loader_recnum recnum, loader_desc POSITION (01:30) char loader_col1 POSITION (31:40) char, loader_col2 POSITION (41:50) char, loader_col3 POSITION (51:60) char, loader_col4 POSITION (61:70) char)
Listing 16.2 is a sample control file for a conventional path load using a variable-format file.
Listing 16.2. Variable-format control file.
LOAD DATA INFILE'data04/ORACLE/TEST/prod' BADFILE'prod.bad' INSERT INTO TABLE prod' FIELDS TERMINATED BY','OPTIONALLY ENCLOSED BY "" trailing nullcols (
continues
Page 376
Listing 16.2. continued
PROD_CODE, PROD_DESCR, PROD_CLASS, PROD MKTG_CODE
terminated by whitespace)
Listing 16.3 is a sample control file for loading a binary EBCDIC file into a USASCII database using the conventional path. Note that the file is also using packed decimal fields.
Listing 16.3. Foreign character set control file.
LOAD DATA CHARACTERSET WE8EBCDIC500 INFILE `data01/ORACLE/TEST/prod_detail'"FIX 28" INSERT INTO TABLE prod_detail ( PROD_CODE position(01:04) char, SALES_MTD_LY position(05:10) decimal(11,2), SALES_YTD_LY position(11:16) decimal(11,2), SALES_MTD position(17:22) decimal(11,2), SALES_YTD position(23:28) decimal(11,2) )
The OPTIONS clause, which enables you to specify some of the runtime arguments in the control file rather than on the command line, is optional. This clause is particularly useful if the length of the command line exceeds the maximum command-line length for your operating system. The arguments you can include in the OPTIONS clause are described in Table 16.1. Even if you specify the arguments in the OPTIONS clause, the command-line specifications override them.
Table 16.1. Control file OPTIONS clause arguments.
Argument | Description |
SKIP = n | Logical records to skip |
LOAD = n | Logical records to load (default all) |
ERRORS = n | Errors to allow before termination |
ROWS = n | Rows in bind array (conventional); rows between saves (direct) |
BINDSIZE = n | Size of bind array in bytes |
SILENT = {HEADERFEEDBACK ERRORDISCARDSALL} | Messages to suppress |
DIRECT = {TRUEFALSE} | Load path method |
PARALLEL = {TRUEFALSE} | Multiple concurrent sessions |