+ All Categories
Home > Documents > [ORACLE 9i] - Database Utilities

[ORACLE 9i] - Database Utilities

Date post: 30-May-2018
Category:
Upload: faqed-ilzakira
View: 222 times
Download: 0 times
Share this document with a friend

of 600

Transcript
  • 8/14/2019 [ORACLE 9i] - Database Utilities

    1/599

    Oracle9i

    Database Utilities

    Release 2 (9.2)

    March 2002

    Part No. A96652-01

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    2/599

    Oracle9i Databa se Ut ilities, Release 2 (9.2)

    Part No. A96652-01

    Copyright 1996, 2002, Oracle Corporat ion. All rights reserved .

    Primary Author: Kathy Rich

    Contributors: Lee Barton, Ellen Batbouta, Janet Blowney, George Claborn, Jay Davison, William Fisher,Dean Gagne, John Galanes, John Kalogeropoulos, Jonathan Klein, Cindy Lim, Eric Magrath, BrianMcCarthy, Ray Pfau, Rich Ph illips, Pau l Reilly, Mike Sakayed a, Francisco Sanchez, Jim Stenoish

    The Programs (which includ e both the software and docum entation) contain prop rietary information of

    Oracle Corporation; they are p rovided u nd er a license agreement containing restrictions on u se anddisclosure and are also protected by copyright, patent and oth er intellectual and indu strial propertylaws. Reverse engineering, d isassembly or decompilation of the Program s, except to the extent requiredto obtain interoperability with other indep enden tly created software or a s specified by law, is prohibited.

    The information contained in this document is subject to change without notice. If you find any problemsin the docum entation, please report them to u s in writing. Oracle Corporation does not warran t that thisdocum ent is error-free. Except a s may be expressly permitted in your license agreement for thesePrograms, no part of these Programs m ay be reprodu ced or transmitted in any form or by any m eans,electronic or mechanical, for any pu rpose, without the express written p ermission of Oracle Corporation.

    If the Programs are delivered to the U.S. Government or anyone licensing or u sing the p rograms onbehalf of the U.S. Government, the following notice is applicable:

    Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercialcompu ter software" and u se, dup lication, and d isclosure of the Programs, including d ocumentation,shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement.Otherwise, Programs delivered subject to the Federal Acqu isition Regulations are "restricted compu tersoftware" and use, du plication, and disclosure of the Program s shall be su bject to the restrictions in FAR52.227-19, Commercial Comp uter Softwa re - Restricted Rights (Jun e, 1987). Oracle Corp oration , 500Oracle Park way, Redw ood City, CA 94065.

    The Programs are not intended for use in any nu clear, aviation, mass transit, medical, or other inherentlydan gerous ap plications. It shall be th e licensee's responsibility to take all app ropriate fail-safe, backup,redun dan cy, and other m easures to ensure the safe use of such app lications if the Programs are u sed forsuch pu rposes, and O racle Corporation d isclaims liability for any dam ages caused by su ch use of thePrograms.

    Oracle is a registered trad emark, and Oracle8, Oracle8i, Oracle9i, Oracle Store, SQL*Plus, Oracle7, andPL/ SQL are trademarks or registered trad emarks of Oracle Corporation. Other names may betradem arks of their respective owners.

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    3/599

    iii

    Contents

    List ofExamplesList ofFiguresList ofTables

    Send Us Your Comments ............................................................................................................. xxxiii

    Preface....................................................................................................................................................... xxxv

    Au dien ce ............................................................................................................................................ xxxv

    Documentation Accessibility ......................................................................................................... xxxvi

    Organizat ion ..................................................................................................................................... xxxvi

    Related Documentation .................................................................................................................. xxxix

    Conventions............................................................................................................................................ xl

    Whats New in Database Utilities? .............................................................................................. xliiiOracle9i Utilities N ew Features for Release 9.2............................................................................... xliii

    Oracle9i Utilities N ew Features for Release 9.0.1............................................................................ xlv

    Oracle8i Utilities New Features ....................................................................................................... xlviii

    Part I Export and Import

    1 Export

    What Is the Export Utility?................................................................................................................ 1-2

    Before Using Export ........................................................................................................................... 1-3

    Running catexp .sql or catalog.sq l............................................................................................... 1-3

    Ensurin g Sufficien t Disk Space................................................................................................... 1-4

    Verifying Access Privileges ......................................................................................................... 1-4

    Invoking Export .................................................................................................................................. 1-5

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    4/599

    iv

    Com mand-Line Entries ................................................................................................................ 1-5

    Interactive Export Prom pts ......................................................................................................... 1-6Parameter Files .............................................................................................................................. 1-6

    Invoking Expor t As SYSDBA ...................................................................................................... 1-7

    Export Modes ....................................................................................................................................... 1-8

    Table-Level an d Part ition-Level Export .................................................................................. 1-12

    Table-Level Expor t .............................................................................................................. 1-12

    Partition-Level Export......................................................................................................... 1-12

    Processing Restrictions............................................................................................................... 1-13

    Getting Online Help......................................................................................................................... 1-13

    Export Parameters ............................................................................................................................. 1-13

    BUFFER ........................................................................................................................................ 1-16

    Exam ple: Calculat ing Buffer Size ...................................................................................... 1-17

    COMPRESS.................................................................................................................................. 1-17

    CONSISTENT.............................................................................................................................. 1-18

    CONSTRAIN TS .......................................................................................................................... 1-20

    DIRECT ........................................................................................................................................ 1-20

    FEEDBACK.................................................................................................................................. 1-20

    FILE............................................................................................................................................... 1-20

    FILESIZE ...................................................................................................................................... 1-21

    FLASHBACK_SCN..................................................................................................................... 1-22

    FLASHBACK_TIME................................................................................................................... 1-22FULL ............................................................................................................................................. 1-23

    GRANTS....................................................................................................................................... 1-23

    HELP............................................................................................................................................. 1-23

    INDEXES...................................................................................................................................... 1-23

    LOG............................................................................................................................................... 1-23

    OBJECT_CONSISTENT ............................................................................................................. 1-24

    OWNER........................................................................................................................................ 1-24PARFILE....................................................................................................................................... 1-24

    QUERY ......................................................................................................................................... 1-24

    Restr iction s ........................................................................................................................... 1-25

    RECORDLEN GTH ..................................................................................................................... 1-26

    RESUMABLE............................................................................................................................... 1-26

    RESUMABLE_NAME ................................................................................................................ 1-26

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    5/599

    v

    RESUMABLE_TIMEOUT.......................................................................................................... 1-27

    ROWS ........................................................................................................................................... 1-27STATISTICS................................................................................................................................. 1-27

    TABLES ........................................................................................................................................ 1-28

    Table Nam e Restrictions..................................................................................................... 1-29

    TABLESPACES ........................................................................................................................... 1-30

    TRANSPORT_TABLESPACE................................................................................................... 1-31

    TRIGGERS ................................................................................................................................... 1-31

    TTS_FULL_CHECK.................................................................................................................... 1-31

    USERID (username/ passw ord)................................................................................................ 1-31

    VOLSIZE ...................................................................................................................................... 1-32

    Parameter Interactions ............................................................................................................... 1-32

    Example Export Sessions ................................................................................................................. 1-32

    Example Export Session in Full Database Mode.................................................................... 1-33

    Exam ple Export Session in User Mod e ................................................................................... 1-36

    Exam ple Export Sessions in Table Mod e ................................................................................ 1-38

    Example 1: DBA Exporting Tables for Two Users.......................................................... 1-38

    Exam ple 2: User Exports Tables That He Owns ............................................................. 1-39

    Example 3: Using Pat tern Matchin g to Expor t Variou s Tables .................................... 1-40

    Example Expor t Session Using Par tition -Level Expor t......................................................... 1-41

    Example 1: Expor ting a Table Withou t Specifying a Partit ion ..................................... 1-41

    Example 2: Exporting a Table w ith a Specified Par tition .............................................. 1-41Exam ple 3: Exporting a Com posite Part ition .................................................................. 1-42

    Using the Interactive Method......................................................................................................... 1-43

    Restr iction s .................................................................................................................................. 1-48

    Warning, Error, and Completion Messages ................................................................................. 1-48

    Log File ........................................................................................................................................ 1-48

    Warning Messages...................................................................................................................... 1-48

    Nonrecoverable Error Messages .............................................................................................. 1-49Com pletion Messages ................................................................................................................ 1-49

    Exit Codes for Inspection and Display ......................................................................................... 1-49

    Conventional Path Export Versus Direct Path Export ............................................................... 1-50

    Invoking a Direct Path Export........................................................................................................ 1-52

    Secur ity Consid erations for Direct Path Exports ................................................................... 1-52

    Per formance Issu es for Direct Path Exports ........................................................................... 1-53

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    6/599

    vi

    Network Considerations.................................................................................................................. 1-53

    Transportin g Export Files Across a Netw ork ......................................................................... 1-53Exporting and Importing with Oracle Net.............................................................................. 1-53

    Character Set and Globalization Support Considerations ....................................................... 1-54

    Character Set Con version .......................................................................................................... 1-54

    Effect of Character Set Sorting Order on Conversions .......................................................... 1-54

    Mu ltibyte Character Sets and Expor t and Imp ort .................................................................. 1-55

    Instance Affinity and Export ........................................................................................................... 1-55

    Considerations When Exporting Database Objects ................................................................... 1-56

    Exporting Sequ ences .................................................................................................................. 1-56

    Exporting LONG and LOB Datatypes..................................................................................... 1-56

    Exporting Foreign Function Librar ies...................................................................................... 1-56

    Exporting Offline Bitm ap ped Tablesp aces ............................................................................. 1-56

    Exporting Directory Aliases ...................................................................................................... 1-57

    Exporting BFILE Columns and Attributes.............................................................................. 1-57

    Extern al Tables ............................................................................................................................ 1-57

    Exporting Object Type Definit ions........................................................................................... 1-57

    Exporting Nested Tables............................................................................................................ 1-58

    Exporting Advanced Queue (AQ) Tables ............................................................................... 1-58

    Exporting Synonym s .................................................................................................................. 1-58

    Possible Expor t Error s Related to Java Synon ym s ......................................................... 1-59

    Support for Fine-Grained Access Control............................................................................... 1-59Transportable Tablespaces .............................................................................................................. 1-59

    Exporting from a Read-Only D atabase ......................................................................................... 1-60

    Using Export and Import to Partition a Database Migration ................................................... 1-60

    Advantages of Partitioning a Migration.................................................................................. 1-61

    Disad vantages of Part itioning a Migra tion ............................................................................. 1-61

    How to Use Expor t and Imp ort to Partition a Database Migration ................................... 1-61

    Using Different Releases and Versions of Export ...................................................................... 1-61Restrictions When Using Differen t Releases and Versions of Export and Im port ............ 1-62

    Examples of Using Differen t Releases of Export and Imp ort .............................................. 1-63

    Creating Oracle Release 8.0 Expor t Files from an Oracle9i Database ................................. 1-64

    Possible Errors When Using Different Releases and Version s............................................. 1-65

    EXP-24 ................................................................................................................................... 1-65

    EXP-23 ................................................................................................................................... 1-65

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    7/599

    vii

    EXP-37 ................................................................................................................................... 1-65

    2 Import

    What Is the Import Utili ty?............................................................................................................... 2-2

    Table Objects: Order of Import ................................................................................................... 2-3

    Before Using Import........................................................................................................................... 2-4

    Running catexp .sql or catalog.sq l............................................................................................... 2-5

    Verifying Access Privileges ......................................................................................................... 2-5Importing Objects into Your Own Schema........................................................................ 2-6

    Importing Gran ts ................................................................................................................... 2-7

    Importing Objects into Oth er Schem as .............................................................................. 2-7

    Importing System Objects .................................................................................................... 2-7

    Importing into Existing Tables ......................................................................................................... 2-8

    Manu ally Creating Tables Before Imp ort ing Data .................................................................. 2-8

    Disabling Referential Constraints .............................................................................................. 2-8Manu ally Ordering the Import ................................................................................................... 2-9

    Effect of Schema and Database Triggers on Import Operations ............................................... 2-9

    Invoking Import................................................................................................................................ 2-10

    Com man d-Line Entries.............................................................................................................. 2-10

    Interactive Import Prom pts ....................................................................................................... 2-10

    Parameter Files............................................................................................................................ 2-11

    Invoking Import As SYSDBA ................................................................................................... 2-12Import Modes .................................................................................................................................... 2-13

    Getting Online Help ........................................................................................................................ 2-14

    Import Parameters ............................................................................................................................ 2-14

    BUFFER ........................................................................................................................................ 2-18

    CH ARSET .................................................................................................................................... 2-18

    COMMIT...................................................................................................................................... 2-19

    COMPILE..................................................................................................................................... 2-19

    CONSTRAIN TS .......................................................................................................................... 2-20

    DATAFILES................................................................................................................................. 2-20

    DESTROY..................................................................................................................................... 2-20

    FEEDBACK.................................................................................................................................. 2-20

    FILE............................................................................................................................................... 2-21

    FILESIZE ...................................................................................................................................... 2-21

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    8/599

    viii

    FROMUSER ................................................................................................................................. 2-22

    FULL ............................................................................................................................................. 2-22GRANTS....................................................................................................................................... 2-22

    HELP............................................................................................................................................. 2-23

    IGN ORE ....................................................................................................................................... 2-23

    INDEXES...................................................................................................................................... 2-24

    INDEXFILE.................................................................................................................................. 2-24

    LOG............................................................................................................................................... 2-25

    PARFILE....................................................................................................................................... 2-25

    RECORDLEN GTH ..................................................................................................................... 2-25

    RESUMABLE............................................................................................................................... 2-26

    RESUMABLE_NAME ................................................................................................................ 2-26

    RESUMABLE_TIMEO UT .......................................................................................................... 2-26

    ROWS ........................................................................................................................................... 2-27

    SHOW........................................................................................................................................... 2-27

    SKIP_UNUSABLE_INDEXES................................................................................................... 2-27

    STATISTICS................................................................................................................................. 2-27

    STREAMS_CONFIGURATION ................................................................................................ 2-28

    STREAMS_INSTAN TIATION .................................................................................................. 2-28

    TABLES ........................................................................................................................................ 2-29

    Table Nam e Restrictions ..................................................................................................... 2-30

    TABLESPACES ........................................................................................................................... 2-31TOID_NOVALIDATE................................................................................................................ 2-31

    TOUSER ....................................................................................................................................... 2-32

    TRAN SPORT_TABLESPACE ................................................................................................... 2-33

    TTS_OWNERS............................................................................................................................. 2-33

    USERID (u sername/ passw ord)................................................................................................ 2-33

    VOLSIZE ...................................................................................................................................... 2-34

    Example Import Sessions ................................................................................................................ 2-34Exam ple Import of Selected Tables for a Specific User ......................................................... 2-35

    Example Imp ort of Tables Expor ted by Another User .......................................................... 2-36

    Example Im port of Tables from On e User to Anoth er .......................................................... 2-37

    Example Imp ort Session Usin g Par tition -Level Im port ........................................................ 2-38

    Exam ple 1: A Part ition-Level Im port................................................................................ 2-38

    Examp le 2: A Pa rtition-Level Imp ort of a Composite Par titioned Table .................... 2-39

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    9/599

    ix

    Example 3: Repartition ing a Table on a Different Colu mn ........................................... 2-40

    Examp le Imp ort of Using Pattern Matching to Imp ort Var ious Tables ............................. 2-43Using the Interactive Method......................................................................................................... 2-44

    Warning, Error, and Completion Messages ................................................................................. 2-45

    Log File ........................................................................................................................................ 2-46

    Warning Messages...................................................................................................................... 2-46

    Nonrecoverable Error Messages .............................................................................................. 2-46

    Com pletion Messages ................................................................................................................ 2-46

    Exit Codes for Inspection and Display ......................................................................................... 2-47Error Handling During an Import ................................................................................................. 2-47

    Row Errors ................................................................................................................................... 2-47

    Failed Integr ity Con str ain ts ............................................................................................... 2-48

    Inva lid Da ta .......................................................................................................................... 2-48

    Errors Importing Database Objects .......................................................................................... 2-48

    Object Already Exists.......................................................................................................... 2-48

    Sequences.............................................................................................................................. 2-49

    Resource Errors.................................................................................................................... 2-49

    Domain Ind ex Metadata ..................................................................................................... 2-49

    Table-Level and Partition-Level Import ....................................................................................... 2-49

    Gu idelines for Using Table-Level Import ............................................................................... 2-50

    Gu idelines for Using Par tit ion-Level Import ......................................................................... 2-50

    Migrating Data Across Partitions and Tables......................................................................... 2-51

    Controlling Index Creation and Maintenance ............................................................................ 2-52

    Delaying Ind ex Creation............................................................................................................ 2-52

    Index Creation and Maintenance Controls............................................................................. 2-52

    Example of Postponing Index Maintenance.................................................................... 2-53

    Reducing Database Fragmentation ............................................................................................... 2-53

    Network Considerations ................................................................................................................. 2-54

    Transporting Export Files Across a Network......................................................................... 2-54Exporting an d Imp orting with Oracle Net ............................................................................. 2-54

    Character Set and Globalization Support Considerations ....................................................... 2-54

    Character Set Con version .......................................................................................................... 2-55

    User Data .............................................................................................................................. 2-55

    Data Defin ition Langu age (DDL)...................................................................................... 2-55

    Import and Single-Byte Character Sets.................................................................................... 2-55

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    10/599

    x

    Import and Multibyte Character Sets ...................................................................................... 2-56

    Considerations When Importing D atabase Objects .................................................................. 2-56Importing Object Identifier s ...................................................................................................... 2-56

    Imp orting Existing Object Tables and Tables That Contain Object Types ......................... 2-58

    Importing Nested Tables ........................................................................................................... 2-58

    Importing REF Data ................................................................................................................... 2-59

    Importing BFILE Columns and Directory Aliases................................................................. 2-59

    Importing Foreign Funct ion Libraries ..................................................................................... 2-60

    Imp ort ing Stored Procedures, Functions, and Packages ..................................................... 2-60Importing Java Objects............................................................................................................... 2-60

    Importing External Tables ......................................................................................................... 2-60

    Importing Advanced Queue (AQ) Tables............................................................................... 2-61

    Importing LON G Columns ....................................................................................................... 2-61

    Importing View s ......................................................................................................................... 2-61

    Importing Part itioned Tables .................................................................................................... 2-62

    Support for Fine-Grained Access Control............................................................................... 2-62

    Materialized View s and Snapshots ............................................................................................... 2-63

    Snapshot Log ............................................................................................................................... 2-63

    Snapshots ..................................................................................................................................... 2-64

    Importing a Snapshot .......................................................................................................... 2-64

    Imp ort ing a Snap shot into a Differen t Schema ............................................................... 2-64

    Transportable Tablespaces .............................................................................................................. 2-64

    Storage Parameters............................................................................................................................ 2-65

    The OPTIMAL Parameter .................................................................................................. 2-66

    Storage Pa rameter s for OID Ind exes and LOB Colum ns............................................... 2-66

    Overrid ing Storage Param eters ......................................................................................... 2-66

    The Export COMPRESS Parameter ................................................................................... 2-66

    Read-Only Tablespaces.............................................................................................................. 2-66

    Dropping a Tablespace..................................................................................................................... 2-67Reorganizing Tablespaces ............................................................................................................... 2-67

    Importing Statistics .......................................................................................................................... 2-68

    Using Export and Import to Partition a Database Migration ................................................... 2-69

    Advantages of Partitioning a Migration.................................................................................. 2-69

    Disad vantages of Part itioning a Migra tion ............................................................................. 2-69

    How to Use Export and Imp ort to Par tition a Database Migrat ion .................................... 2-69

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    11/599

    xi

    Using Export Files from a Previous Oracle Release ................................................................... 2-70

    Using Oracle Version 7 Export Files ........................................................................................ 2-70Check Constraints on DATE Columns............................................................................. 2-70

    Using Oracle Version 6 Export Files ........................................................................................ 2-71

    User Pr ivileges ..................................................................................................................... 2-71

    CHAR Columns................................................................................................................... 2-71

    Status of Integrity Con straints ........................................................................................... 2-71

    Length of Default Colu mn Values .................................................................................... 2-71

    Using Oracle Version 5 Export Files ........................................................................................ 2-72Restrictions When Using Different Releases and Versions of Export and Impor t ........... 2-72

    The CH ARSET Parameter ......................................................................................................... 2-73

    Part II SQL*Loader

    3 SQL*Loader ConceptsSQL*Loader Features ......................................................................................................................... 3-1

    SQL*Loader Control File ................................................................................................................... 3-3

    Input Data and D atafiles ................................................................................................................... 3-4

    Fixed Record Format .................................................................................................................... 3-4

    Variable Record Format ............................................................................................................... 3-5

    Stream Record Format ................................................................................................................ 3-6

    Logical Record s ............................................................................................................................. 3-7Data Fields ..................................................................................................................................... 3-8

    LOBFILEs and Secondary Datafiles (SDFs) ................................................................................... 3-9

    Data Conversion and Datatype Specification ............................................................................... 3-9

    Discarded and Rejected Records ................................................................................................... 3-10

    The Bad File ................................................................................................................................. 3-10

    SQL*Loader Rejects ............................................................................................................. 3-10

    Oracle Rejects ....................................................................................................................... 3-10

    The Discard File .......................................................................................................................... 3-11

    Log File and Logging Information ................................................................................................ 3-11

    Conventional Path Loads, D irect Path Loads, and External Table Loads .............................. 3-11

    Con vent ional Path Load s .......................................................................................................... 3-12

    Direct Path Loads ....................................................................................................................... 3-12

    Parallel Direct Path.............................................................................................................. 3-12

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    12/599

    xii

    Extern al Table Loads .................................................................................................................. 3-13

    Loading Objects, Collections, and LOBs...................................................................................... 3-13Sup ported Object Types............................................................................................................. 3-13

    colu mn-objects ..................................................................................................................... 3-13

    row objects ............................................................................................................................ 3-14

    Sup ported Collection Typ es ...................................................................................................... 3-14

    Nested Tables ....................................................................................................................... 3-14

    VARRAYs ............................................................................................................................. 3-14

    Suppor ted LOB Typ es ................................................................................................................ 3-14Partitioned Object Support ............................................................................................................. 3-15

    Application D evelopment: Direct Path Load API ...................................................................... 3-15

    4 SQL*Loader Command-Line Reference

    Invoking SQL*Loader ....................................................................................................................... 4-1

    Specifying Parameters in the Control File................................................................................. 4-3Command-Line Parameters............................................................................................................... 4-3

    BAD (bad file)................................................................................................................................ 4-3

    BINDSIZE (maximum size)......................................................................................................... 4-4

    COLUMNARRAYROWS............................................................................................................. 4-4

    CONTROL (control file)............................................................................................................... 4-4

    DATA (datafile)............................................................................................................................. 4-5

    DATE_CACHE.............................................................................................................................. 4-5DIRECT (data path)...................................................................................................................... 4-6

    DISCARD (filen am e) .................................................................................................................... 4-6

    DISCARDMAX (integer) ............................................................................................................. 4-6

    ERRORS (errors to allow ) ............................................................................................................ 4-6

    EXTERNAL_TABLE..................................................................................................................... 4-7

    Restrict ions When Using EXTERNAL_TABLE................................................................. 4-8

    FILE (file to load into) .................................................................................................................. 4-9

    LOAD (record s to load) ............................................................................................................... 4-9

    LOG (log file)................................................................................................................................. 4-9

    MULTITHREADING ................................................................................................................... 4-9

    PARALLEL (parallel load) ........................................................................................................ 4-10

    PARFILE (param eter file) .......................................................................................................... 4-10

    READSIZE (read bu ffer size) .................................................................................................... 4-10

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    13/599

    xiii

    RESUMABLE............................................................................................................................... 4-11

    RESUMABLE_NAME................................................................................................................ 4-12RESUMABLE_TIMEOUT.......................................................................................................... 4-12

    ROWS (row s per commit) ......................................................................................................... 4-12

    SILENT (feed back mod e) .......................................................................................................... 4-12

    SKIP (records to skip)................................................................................................................. 4-13

    SKIP_INDEX_MAINTENAN CE .............................................................................................. 4-14

    SKIP_UNUSABLE_INDEXES................................................................................................... 4-14

    STREAMSIZE.............................................................................................................................. 4-15USERID (username/ passw ord)................................................................................................ 4-15

    Exit Codes for Inspection and Display ......................................................................................... 4-16

    5 SQL*Loader Control File Reference

    Control File Contents ......................................................................................................................... 5-2

    Com ments in the Con trol File..................................................................................................... 5-4Specifying Command-Line Parameters in the Control File ....................................................... 5-4

    OPTIONS Clause .......................................................................................................................... 5-4

    Specifying Filenames and Object Names ...................................................................................... 5-5

    Filenam es That Con flict with SQL and SQL*Load er Reserved Word s ................................ 5-5

    Specify ing SQL Strings ................................................................................................................ 5-5

    Op erating System Consid erations ............................................................................................. 5-5

    Specifying a Com plete Path ................................................................................................. 5-6Backslash Escap e Character ................................................................................................. 5-6

    Nonportable Strin gs .............................................................................................................. 5-6

    Escap ing the Backslash ......................................................................................................... 5-7

    Escap e Character Is Som etim es Disallow ed ...................................................................... 5-7

    Specifying Datafiles ........................................................................................................................... 5-7

    Exam ples of INFILE Syntax ........................................................................................................ 5-9

    Specifying Mu ltip le Datafiles ..................................................................................................... 5-9

    Identifying Data in the Control File with BEGINDATA .......................................................... 5-10

    Specifying Datafile Format and Buffering................................................................................... 5-11

    Specifying the Bad File .................................................................................................................... 5-11

    Exam ples of Specifying a Bad File N am e................................................................................ 5-13

    How Bad Files Are Handled with LOBFILEs and SDFs....................................................... 5-13

    Criteria for Rejected Records .................................................................................................... 5-13

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    14/599

    xiv

    Specifying the D iscard File ............................................................................................................. 5-14

    Specifying the Discard File in the Control File....................................................................... 5-14Specifying the Discard File from the Com mand Line ........................................................... 5-15

    Exam ples of Specifyin g a Discard File Nam e ......................................................................... 5-15

    Criter ia for Discarded Records ................................................................................................. 5-15

    How Discard Files Are H andled with LOBFILEs and SDFs ................................................ 5-16

    Limiting the Number of Discarded Records........................................................................... 5-16

    Handling Di fferent Character Encoding Schemes ..................................................................... 5-16

    Mu ltibyte (Asian) Character Sets.............................................................................................. 5-17Unicod e Character Sets .............................................................................................................. 5-17

    Database Character Sets ............................................................................................................. 5-18

    Datafile Character Sets ............................................................................................................... 5-18

    Inp ut Character Con version ...................................................................................................... 5-19

    CH ARACTERSET Parameter ............................................................................................ 5-19

    Con trol File Character Set .................................................................................................. 5-21

    Character-Length Seman tics .............................................................................................. 5-22

    Interrupted Loads.............................................................................................................................. 5-24

    Discontinued Conventional Path Loads.................................................................................. 5-24

    Discontinued Direct Path Load s ............................................................................................... 5-24

    Load Discontinued Becau se of Space Errors ................................................................... 5-24

    Load Discontinu ed Because Maximum Number of Errors Exceeded ......................... 5-25

    Load Discontinued Because of Fatal Errors..................................................................... 5-25

    Load Discon tinued Becau se a Con tro l+C Was Issued ................................................... 5-25

    Statu s of Tables an d Ind exes After an Interrupted Load ...................................................... 5-26

    Using the Log File to Determine Load Status......................................................................... 5-26

    Con tinu ing Single-Table Loads ................................................................................................ 5-26

    Assembling Logical Records from Physical Records ................................................................. 5-27

    Using CON CATENATE to Assemble Logical Record s ........................................................ 5-27

    Using CON TINUEIF to Assem ble Logical Records .............................................................. 5-27Loading Logical Records into Tables ............................................................................................ 5-31

    Specifying Table Nam es ............................................................................................................ 5-32

    INTO TABLE Clause ........................................................................................................... 5-32

    Table-Specific Loading Method ................................................................................................ 5-32

    Load ing Data into Empty Tables....................................................................................... 5-33

    Load ing Data into Nonem pty Tables ............................................................................... 5-33

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    15/599

    xv

    Table-Specific OPTION S Parameter ........................................................................................ 5-34

    Load ing Records Based on a Condition .................................................................................. 5-35Using the WHEN Clause with LOBFILEs and SDFs...................................................... 5-35

    Specifying Defau lt Data Delimiters ......................................................................................... 5-36

    fields_spec ............................................................................................................................ 5-36

    term ination_spec ................................................................................................................. 5-36

    enclosure_sp ec ..................................................................................................................... 5-36

    Handling Short Records with Missing Data........................................................................... 5-37

    TRAILING NULLCOLS Clause ........................................................................................ 5-37Index Options .................................................................................................................................... 5-38

    SORTED INDEXES Clause........................................................................................................ 5-38

    SINGLEROW Option ................................................................................................................. 5-38

    Benefits of Using Multiple INTO TABLE Clauses ..................................................................... 5-39

    Extracting Mu ltip le Logical Records ....................................................................................... 5-39

    Relative Positioning Based on Delimiters........................................................................ 5-40

    Distinguishing Differen t Inp ut Record Form ats .................................................................... 5-40

    Relative Position ing Based on the POSITION Param eter ............................................. 5-41

    Distinguishing Differen t Inp ut Row Object Subtypes .......................................................... 5-41

    Load ing Data in to Mu ltip le Tables .......................................................................................... 5-43

    Summary...................................................................................................................................... 5-43

    Bind Arrays and Conventional Path Loads ................................................................................. 5-44

    Size Requ irements for Bind Arrays.......................................................................................... 5-44

    Per formance Implications of Bind Ar rays .............................................................................. 5-44

    Specifying Number of Row s Versus Size of Bind Array ...................................................... 5-45

    Calculations to Determine Bind Array Size............................................................................ 5-45

    Determining the Size of the Length Ind icator ................................................................. 5-47

    Calculating the Size of Field Buffers ................................................................................. 5-47

    Minimizing Mem ory Requ irem ents for Bind Arrays ............................................................ 5-49

    Calcu lating Bind Array Size for Multip le INTO TABLE Clauses ....................................... 5-50

    6 Field List Reference

    Field List Contents .............................................................................................................................. 6-1

    Specifying the Position of a Data Field .......................................................................................... 6-3

    Using POSITION with Data Containing Tabs.......................................................................... 6-4

    Using POSITION with Multip le Table Load s .......................................................................... 6-4

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    16/599

    xvi

    Exam ples of Using POSITION .................................................................................................... 6-4

    Specifying Columns and Fields ....................................................................................................... 6-5Specifying Filler Fields ................................................................................................................. 6-6

    Specifying the Datatype of a Data Field .................................................................................... 6-7

    SQL*Loader Datatypes ...................................................................................................................... 6-7

    Nonportable Datatypes ................................................................................................................ 6-8

    INTEGER(n) ........................................................................................................................... 6-8

    SMALLINT ............................................................................................................................. 6-9

    FLOAT..................................................................................................................................... 6-9DOUBLE ............................................................................................................................... 6-10

    BYTEINT............................................................................................................................... 6-10

    ZONED ................................................................................................................................. 6-10

    DECIMAL ............................................................................................................................. 6-11

    VARGRAPHIC..................................................................................................................... 6-12

    VARCHAR ........................................................................................................................... 6-13

    VARRAW.............................................................................................................................. 6-14

    LONG VARRAW................................................................................................................. 6-14

    Portable Datatypes...................................................................................................................... 6-14

    CH AR .................................................................................................................................... 6-15

    Datetim e and Interval Datatypes ...................................................................................... 6-16

    GRAPH IC ............................................................................................................................. 6-18

    GRAPHIC EXTERNAL....................................................................................................... 6-19

    Numeric EXTERNAL.......................................................................................................... 6-19

    RAW ...................................................................................................................................... 6-20

    VARCHARC......................................................................................................................... 6-20

    VARRAWC ........................................................................................................................... 6-21

    Con flicting Native Datatyp e Field Lengths ..................................................................... 6-21

    Field Lengths for Length-Value Datatypes...................................................................... 6-22

    Datatype Con versions ................................................................................................................ 6-22Datatype Conversions for Datetime and Interval Datatypes ............................................... 6-23

    Specifying Delim iters ................................................................................................................. 6-24

    TERMIN ATED Fields ......................................................................................................... 6-25

    ENCLOSED Fields............................................................................................................... 6-25

    Delimiter Marks in the Data ............................................................................................... 6-26

    Maximum Length of Delimited Data ............................................................................... 6-27

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    17/599

    xvii

    Loading Trailing Blanks with Delimiters......................................................................... 6-27

    Conflicting Field Lengths for Character Datatyp es ............................................................... 6-28Pred eterm ined Size Field s.................................................................................................. 6-28

    Delimited Fields................................................................................................................... 6-28

    Date Field Masks ................................................................................................................. 6-29

    Specifying Field Conditions ........................................................................................................... 6-29

    Com paring Field s to BLAN KS ................................................................................................. 6-31

    Com paring Field s to Literals .................................................................................................... 6-32

    Using the WHEN, NULLIF, and DEFAULTIF Clauses .............................................................. 6-32Loading Data Across Different Platforms ................................................................................... 6-36

    Byte Ordering .................................................................................................................................... 6-37

    Specify ing Byte Ord er ................................................................................................................ 6-38

    Using Byte Order Marks (BOMs) ............................................................................................. 6-39

    Sup pressin g Checks for BOMs .......................................................................................... 6-41

    Loading All-Blank Fields ................................................................................................................ 6-41

    Trimming Whitespace ...................................................................................................................... 6-42

    Datatypes for Which Whitesp ace Can Be Trimmed .............................................................. 6-44

    Field Length Specifications for Data typ es for Which Whitesp ace Can Be Trimmed ....... 6-45

    Pred eterm ined Size Field s.................................................................................................. 6-45

    Delimited Fields................................................................................................................... 6-45

    Relat ive Position ing of Field s ................................................................................................... 6-46

    No Star t Posit ion Specified for a Field ............................................................................. 6-46

    Previou s Field Terminated by a Delimiter ...................................................................... 6-46

    Previous Field H as Both Enclosure and Termination Delimiters ................................ 6-47

    Lead ing Whitespace ................................................................................................................... 6-47

    Previous Field Terminated by Whitespace...................................................................... 6-47

    Op tional Enclosu re Delimiters .......................................................................................... 6-48

    Trailing Whitespace.................................................................................................................... 6-49

    Enclosed Fields............................................................................................................................ 6-49Preserving Whitespace ..................................................................................................................... 6-49

    PRESERVE BLANKS Option .................................................................................................... 6-49

    Term inated by Whitespace ................................................................................................ 6-50

    Applying SQL Operators to Fields ................................................................................................ 6-50

    Referencing Fields ...................................................................................................................... 6-52

    Com mon Uses of SQL Operators in Field Specifications ..................................................... 6-53

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    18/599

    xviii

    Com binations of SQL Operators .............................................................................................. 6-53

    Using SQL Str ings with a Date Mask....................................................................................... 6-53Interpreting Formatted Field s ................................................................................................... 6-54

    Using SQL*Loader to Generate Data for Input........................................................................... 6-54

    Load ing Data Without Files ...................................................................................................... 6-55

    Setting a Column to a Constant Value..................................................................................... 6-55

    CONSTANT Parameter ...................................................................................................... 6-55

    Setting a Column to an Expression Value............................................................................... 6-56

    EXPRESSION Parameter .................................................................................................... 6-56Setting a Column to the Datafile Record Number ................................................................. 6-56

    RECNUM Parameter........................................................................................................... 6-56

    Settin g a Column to the Curren t Date ..................................................................................... 6-56

    SYSDATE Parameter ........................................................................................................... 6-56

    Setting a Column to a Uniqu e Sequence Number ................................................................. 6-57

    SEQUEN CE Parameter ....................................................................................................... 6-57

    Genera ting Sequence N umbers for Mu ltip le Tables ............................................................. 6-58

    Examp le: Genera ting Differen t Sequence Num bers for Each Insert ............................ 6-58

    7 Loading Objects, LOBs, and Collections

    Loading Column Objects................................................................................................................... 7-1

    Loading Column Objects in Stream Record Format................................................................ 7-2

    Load ing Colu mn Objects in Variable Record Form at ............................................................. 7-3Load ing N ested Colu mn Objects ............................................................................................... 7-4

    Load ing Colu mn Objects with a Der ived Subtyp e .................................................................. 7-4

    Specifying Null Valu es for Objects ............................................................................................ 7-6

    Specifying Attr ibu te Nulls ................................................................................................... 7-6

    Specifying Atom ic Nulls....................................................................................................... 7-7

    Load ing Column Objects with User-Defined Constructors ................................................... 7-8

    Loading Object Tables ..................................................................................................................... 7-12Load ing Object Tables with a Subtyp e .................................................................................... 7-13

    Loading REF Columns ..................................................................................................................... 7-15

    Real REF Columns ...................................................................................................................... 7-15

    Primary Key REF Colu mns ....................................................................................................... 7-16

    Unscoped REF Colu mns That Allow Prim ary Keys.............................................................. 7-16

    Loading LOBs .................................................................................................................................... 7-18

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    19/599

    xix

    Loading LOB Data from a Primary Datafile........................................................................... 7-19

    LOB Data in Predetermined Size Fields........................................................................... 7-19LOB Data in Delimited Field s............................................................................................ 7-20

    LOB Data in Length-Value Pair Field s ............................................................................. 7-21

    Load ing LOB Data from an External LOBFILE (BFILE)....................................................... 7-22

    Load ing LOB Data from LOBFILEs ......................................................................................... 7-23

    Dynam ic Versu s Stat ic LOBFILE Specifications ............................................................. 7-24

    Exam ples of Loading LOB Data from LOBFILEs ........................................................... 7-24

    Considera tions When Load ing LOBs from LOBFILEs .................................................. 7-28Loading Collections (Nested Tables and VARRAYs)................................................................. 7-29

    Restrict ions in Nested Tables an d VARRAYs ........................................................................ 7-30

    Secondary Datafiles (SDFs) ....................................................................................................... 7-31

    Dynamic Versus Static SDF Specifications .................................................................................. 7-33

    Loading a Parent Table Separately from Its Child Table .......................................................... 7-33

    Mem ory Issues When Load ing VARRAY Colu mns ............................................................. 7-34

    8 SQL*Loader Log File Reference

    Header Information ............................................................................................................................ 8-1

    Global Information ............................................................................................................................ 8-2

    Table Information ............................................................................................................................... 8-2

    Colu mn Inform ation .................................................................................................................... 8-3

    Posit ion ................................................................................................................................... 8-3Length ..................................................................................................................................... 8-4

    Delim iter ................................................................................................................................. 8-4

    Datatype.................................................................................................................................. 8-4

    Datafile Information ........................................................................................................................... 8-4

    Table Load Information ..................................................................................................................... 8-5

    Summary Statistics ............................................................................................................................. 8-5

    Oracle Stat istics Tha t Are Logged .............................................................................................. 8-6Inform ation About Single-Part ition Loads ........................................................................ 8-7

    Statistics for Loading a Table ............................................................................................... 8-7

    Additional Summary Statistics for Direct Path Loads and Multithreading ........................... 8-7

    Log File Created When EXTERNAL_TABLE=GENERATE_ONLY .......................................... 8-8

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    20/599

    xx

    9 Conventional and Direct Path Loads

    Data Loading Methods ....................................................................................................................... 9-1

    Conventional Path Load .................................................................................................................... 9-4

    Con ventional Path Load of a Sing le Partit ion .......................................................................... 9-4

    When to Use a Conventional Path Load ................................................................................... 9-4

    Direct Path Load .................................................................................................................................. 9-5

    Data Con version Du rin g Direct Path Load s ............................................................................. 9-6

    Direct Path Load of a Partition ed or Subp artition ed Table .................................................... 9-6

    Direct Path Load of a Single Par tition or Subp art ition ............................................................ 9-7

    Ad vantages of a Direct Path Load .............................................................................................. 9-8

    Restrictions on Using Direct Path Loads................................................................................... 9-8

    Restrictions on a Direct Path Load of a Single Par tition ......................................................... 9-9

    When to Use a Direct Path Load ................................................................................................. 9-9

    Integr ity Con stra ints .................................................................................................................. 9-10

    Field Defaults on the Direct Path .............................................................................................. 9-10Load ing into Synonym s ............................................................................................................. 9-10

    Using D irect Path Load .................................................................................................................... 9-10

    Settin g Up for Direct Path Load s.............................................................................................. 9-10

    Specifying a Direct Path Load ................................................................................................... 9-11

    Build ing Indexes ......................................................................................................................... 9-11

    Improvin g Per formance...................................................................................................... 9-11

    Temporary Segm ent Storage Requ irements .................................................................... 9-12Ind exes Left in an Unusable State ............................................................................................ 9-12

    Using Data Saves to Protect Aga inst Data Loss ..................................................................... 9-13

    Using the ROWS Parameter ............................................................................................... 9-14

    Data Save Versus Com mit.................................................................................................. 9-14

    Data Recovery Durin g Direct Path Loads ............................................................................... 9-15

    Media Recovery and Direct Path Loads........................................................................... 9-15

    Instance Recovery and Dir ect Path Load s ....................................................................... 9-15Load ing LON G Data Field s....................................................................................................... 9-16

    Loading Data As PIECED................................................................................................... 9-16

    Optimizing Performance of Direct Path Loads ........................................................................... 9-17

    Preallocating Storage for Faster Load ing ................................................................................ 9-17

    Presort ing Data for Faster Ind exing ......................................................................................... 9-18

    SORTED INDEXES Clause................................................................................................. 9-18

  • 8/14/2019 [ORACLE 9i] - Database Utilities

    21/599

    xxi

    Un sorted Data ...................................................................................................................... 9-18

    Mu ltip le-Column Ind exes .................................................................................................. 9-19Choosing the Best Sort Order ............................................................................................ 9-19

    Infrequent Data Saves ................................................................................................................ 9-20

    Min imizin g Use of the Redo Log ............................................................................................. 9-20

    Disabling Archiv ing ............................................................................................................ 9-20

    Specifying the UN RECOVERABLE Parameter .............................................................. 9-20

    Setting the NOLOG Attr ibu te............................................................................................ 9-21

    Specifying the N um ber of Colum n Ar ray Row s and Size of Stream Buffers .................... 9-21Specifying a Valu e for the Date Cache .................................................................................... 9-22

    Optimizing D irect Path Loads on Multiple -CPU Systems ....................................................... 9-23

    Avoiding Index Maintenance ......................................................................................................... 9-24

    Direct Loads, Integrity Constraints, and Triggers ...................................................................... 9-25

    Integr ity Con str ain ts .................................................................................................................. 9-25

    Enabled Con str ain ts ............................................................................................................ 9-25

    Disabled Con stra ints ........................................................................................................... 9-25

    Reenable Con stra ints .......................................................................................................... 9-26

    Database Insert Trigger s ............................................................................................................ 9-27

    Replacing Inser t Triggers w ith Integrity Constraints .................................................... 9-27

    When Au tom atic Constrain ts Can not Be Used ............................................................... 9-27

    Prep arat ion ........................................................................................................................... 9-28

    Using an Up date Trigger .................................................................................................... 9-28

    Duplicating the Effects of Exception Conditions............................................................ 9-28


Recommended