Oracle9 i Database Utilities Release 2 (9.2) March 2002 Part No. A96652-01 Oracle9i Database Utilities, Release 2 (9.2) Part No. A96652-01 Copyright © 1996, 2002, Oracle Corporation. 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, Brian McCarthy, Ray Pfau, Rich Phillips, Paul Reilly, Mike Sakayeda, Francisco Sanchez, Jim Stenoish The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent and other intellectual and industrial property laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation. If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on behalf of the U.S. Government, the following notice is applicable: Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer software" and use, duplication, and disclosure of the Programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and Oracle8, Oracle8i, Oracle9i, Oracle Store, SQL*Plus, Oracle7, and PL/SQL are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners. iii Contents List of Examples List of Figures List of Tables Send Us Your Comments xxxiii Preface xxxv Audience xxxv Documentation Accessibility xxxvi Organization xxxvi Related Documentation xxxix Conventions xl What’s New in Database Utilities? xliii Oracle9i Utilities New Features for Release 9.2 xliii Oracle9i Utilities New 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.sql 1-3 Ensuring Sufficient Disk Space 1-4 Verifying Access Privileges 1-4 Invoking Export 1-5 iv Command-Line Entries 1-5 Interactive Export Prompts 1-6 Parameter Files 1-6 Invoking Export As SYSDBA 1-7 Export Modes 1-8 Table-Level and Partition-Level Export 1-12 Table-Level Export 1-12 Partition-Level Export 1-12 Processing Restrictions 1-13 Getting Online Help 1-13 Export Parameters 1-13 BUFFER 1-16 Example: Calculating Buffer Size 1-17 COMPRESS 1-17 CONSISTENT 1-18 CONSTRAINTS 1-20 DIRECT 1-20 FEEDBACK 1-20 FILE 1-20 FILESIZE 1-21 FLASHBACK_SCN 1-22 FLASHBACK_TIME 1-22 FULL 1-23 GRANTS 1-23 HELP 1-23 INDEXES 1-23 LOG 1-23 OBJECT_CONSISTENT 1-24 OWNER 1-24 PARFILE 1-24 QUERY 1-24 Restrictions 1-25 RECORDLENGTH 1-26 RESUMABLE 1-26 RESUMABLE_NAME 1-26 v RESUMABLE_TIMEOUT 1-27 ROWS 1-27 STATISTICS 1-27 TABLES 1-28 Table Name Restrictions 1-29 TABLESPACES 1-30 TRANSPORT_TABLESPACE 1-31 TRIGGERS 1-31 TTS_FULL_CHECK 1-31 USERID (username/password) 1-31 VOLSIZE 1-32 Parameter Interactions 1-32 Example Export Sessions 1-32 Example Export Session in Full Database Mode 1-33 Example Export Session in User Mode 1-36 Example Export Sessions in Table Mode 1-38 Example 1: DBA Exporting Tables for Two Users 1-38 Example 2: User Exports Tables That He Owns 1-39 Example 3: Using Pattern Matching to Export Various Tables 1-40 Example Export Session Using Partition-Level Export 1-41 Example 1: Exporting a Table Without Specifying a Partition 1-41 Example 2: Exporting a Table with a Specified Partition 1-41 Example 3: Exporting a Composite Partition 1-42 Using the Interactive Method 1-43 Restrictions 1-48 Warning, Error, and Completion Messages 1-48 Log File 1-48 Warning Messages 1-48 Nonrecoverable Error Messages 1-49 Completion 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 Security Considerations for Direct Path Exports 1-52 Performance Issues for Direct Path Exports 1-53 vi Network Considerations 1-53 Transporting Export Files Across a Network 1-53 Exporting and Importing with Oracle Net 1-53 Character Set and Globalization Support Considerations 1-54 Character Set Conversion 1-54 Effect of Character Set Sorting Order on Conversions 1-54 Multibyte Character Sets and Export and Import 1-55 Instance Affinity and Export 1-55 Considerations When Exporting Database Objects 1-56 Exporting Sequences 1-56 Exporting LONG and LOB Datatypes 1-56 Exporting Foreign Function Libraries 1-56 Exporting Offline Bitmapped Tablespaces 1-56 Exporting Directory Aliases 1-57 Exporting BFILE Columns and Attributes 1-57 External Tables 1-57 Exporting Object Type Definitions 1-57 Exporting Nested Tables 1-58 Exporting Advanced Queue (AQ) Tables 1-58 Exporting Synonyms 1-58 Possible Export Errors Related to Java Synonyms 1-59 Support for Fine-Grained Access Control 1-59 Transportable Tablespaces 1-59 Exporting from a Read-Only Database 1-60 Using Export and Import to Partition a Database Migration 1-60 Advantages of Partitioning a Migration 1-61 Disadvantages of Partitioning a Migration 1-61 How to Use Export and Import to Partition a Database Migration 1-61 Using Different Releases and Versions of Export 1-61 Restrictions When Using Different Releases and Versions of Export and Import 1-62 Examples of Using Different Releases of Export and Import 1-63 Creating Oracle Release 8.0 Export Files from an Oracle9i Database 1-64 Possible Errors When Using Different Releases and Versions 1-65 EXP-24 1-65 EXP-23 1-65 vii EXP-37 1-65 2 Import What Is the Import Utility? 2-2 Table Objects: Order of Import 2-3 Before Using Import 2-4 Running catexp.sql or catalog.sql 2-5 Verifying Access Privileges 2-5 Importing Objects into Your Own Schema 2-6 Importing Grants 2-7 Importing Objects into Other Schemas 2-7 Importing System Objects 2-7 Importing into Existing Tables 2-8 Manually Creating Tables Before Importing Data 2-8 Disabling Referential Constraints 2-8 Manually Ordering the Import 2-9 Effect of Schema and Database Triggers on Import Operations 2-9 Invoking Import 2-10 Command-Line Entries 2-10 Interactive Import Prompts 2-10 Parameter Files 2-11 Invoking Import As SYSDBA 2-12 Import Modes 2-13 Getting Online Help 2-14 Import Parameters 2-14 BUFFER 2-18 CHARSET 2-18 COMMIT 2-19 COMPILE 2-19 CONSTRAINTS 2-20 DATAFILES 2-20 DESTROY 2-20 FEEDBACK 2-20 FILE 2-21 FILESIZE 2-21 viii FROMUSER 2-22 FULL 2-22 GRANTS 2-22 HELP 2-23 IGNORE 2-23 INDEXES 2-24 INDEXFILE 2-24 LOG 2-25 PARFILE 2-25 RECORDLENGTH 2-25 RESUMABLE 2-26 RESUMABLE_NAME 2-26 RESUMABLE_TIMEOUT 2-26 ROWS 2-27 SHOW 2-27 SKIP_UNUSABLE_INDEXES 2-27 STATISTICS 2-27 STREAMS_CONFIGURATION 2-28 STREAMS_INSTANTIATION 2-28 TABLES 2-29 Table Name Restrictions 2-30 TABLESPACES 2-31 TOID_NOVALIDATE 2-31 TOUSER 2-32 TRANSPORT_TABLESPACE 2-33 TTS_OWNERS 2-33 USERID (username/password) 2-33 VOLSIZE 2-34 Example Import Sessions 2-34 Example Import of Selected Tables for a Specific User 2-35 Example Import of Tables Exported by Another User 2-36 Example Import of Tables from One User to Another 2-37 Example Import Session Using Partition-Level Import 2-38 Example 1: A Partition-Level Import 2-38 Example 2: A Partition-Level Import of a Composite Partitioned Table 2-39 ix Example 3: Repartitioning a Table on a Different Column 2-40 Example Import of Using Pattern Matching to Import Various Tables 2-43 Using 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 Completion Messages 2-46 Exit Codes for Inspection and Display 2-47 Error Handling During an Import 2-47 Row Errors 2-47 Failed Integrity Constraints 2-48 Invalid Data 2-48 Errors Importing Database Objects 2-48 Object Already Exists 2-48 Sequences 2-49 Resource Errors 2-49 Domain Index Metadata 2-49 Table-Level and Partition-Level Import 2-49 Guidelines for Using Table-Level Import 2-50 Guidelines for Using Partition-Level Import 2-50 Migrating Data Across Partitions and Tables 2-51 Controlling Index Creation and Maintenance 2-52 Delaying Index 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-54 Exporting and Importing with Oracle Net 2-54 Character Set and Globalization Support Considerations 2-54 Character Set Conversion 2-55 User Data 2-55 Data Definition Language (DDL) 2-55 Import and Single-Byte Character Sets 2-55 x Import and Multibyte Character Sets 2-56 Considerations When Importing Database Objects 2-56 Importing Object Identifiers 2-56 Importing 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 Function Libraries 2-60 Importing Stored Procedures, Functions, and Packages 2-60 Importing Java Objects 2-60 Importing External Tables 2-60 Importing Advanced Queue (AQ) Tables 2-61 Importing LONG Columns 2-61 Importing Views 2-61 Importing Partitioned Tables 2-62 Support for Fine-Grained Access Control 2-62 Materialized Views and Snapshots 2-63 Snapshot Log 2-63 Snapshots 2-64 Importing a Snapshot 2-64 Importing a Snapshot into a Different Schema 2-64 Transportable Tablespaces 2-64 Storage Parameters 2-65 The OPTIMAL Parameter 2-66 Storage Parameters for OID Indexes and LOB Columns 2-66 Overriding Storage Parameters 2-66 The Export COMPRESS Parameter 2-66 Read-Only Tablespaces 2-66 Dropping a Tablespace 2-67 Reorganizing 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 Disadvantages of Partitioning a Migration 2-69 How to Use Export and Import to Partition a Database Migration 2-69 [...]... VARCHARC and VARRAWC init_spec Clause Part IV 12- 12 12- 12 12- 13 12- 14 12- 15 12- 16 12- 18 12- 18 12- 19 12- 19 12- 20 12- 21 12- 22 12- 23 12- 23 12- 23 12- 23 12- 23 12- 24 12- 26 12- 26 12- 26 12- 26 12- 27 12- 27 12- 27 12- 27 12- 28 12- 29 12- 30 12- 31 Other Utilities xxv 13 DBVERIFY: Offline Database Verification Utility Using DBVERIFY to Validate Disk Blocks of a Single Datafile Syntax ... Direct Path Load 9-18 9-19 9-19 9 -20 9 -20 9 -20 9 -20 9 -21 9 -21 9 -22 9 -23 9 -24 9 -25 9 -25 9 -25 9 -25 9 -26 9 -27 9 -27 9 -27 9 -28 9 -28 9 -28 9 -29 9-30 9-30 9-30 9-31 9-31 9-31 9- 32 9- 32 9-33 9-33 9-34 xxi PRIMARY KEY and UNIQUE KEY Constraints 9-35 General Performance Improvement Hints 9-35 10 SQL*Loader Case Studies The Case Studies 10 -2 Case Study Files ... Loading Data into Empty Tables Loading Data into Nonempty Tables xiv 5-14 5-14 5-15 5-15 5-15 5-16 5-16 5-16 5-17 5-17 5-18 5-18 5-19 5-19 5 -21 5 -22 5 -24 5 -24 5 -24 5 -24 5 -25 5 -25 5 -25 5 -26 5 -26 5 -26 5 -27 5 -27 5 -27 5-31 5- 32 5- 32 5- 32 5-33 5-33 Table-Specific OPTIONS Parameter Loading Records Based on a Condition Using the WHEN Clause with LOBFILEs and SDFs Specifying... LOB Data Using Delimited LOBs Loading LOB Data Using Length-Value Pair Specified LOBs 3-5 3-6 3-7 5 -2 5-30 5-30 5-30 5-31 6 -2 6-34 6-34 6-35 6-36 7 -2 7-3 7-4 7-5 7-6 7-7 7-8 7-10 7-11 7- 12 7-13 7-14 7-15 7-16 7-19 7 -20 7 -21 7 -22 7 -23 7 -25 7 -26 7 -26 7 -27 7 24 7 25 7 26 9–1 9 2 Loading a VARRAY and a Nested Table Loading a Parent Table with User-Provided SIDs Loading a Child... DBCS Graphic Strings SQL*Loader Syntax with DB2 -Compatible Statements C B-1 B -2 B -2 B -2 B -2 B-3 B-3 B-3 B-3 B-4 B-4 B-4 Backus-Naur Form Syntax Index xxvii List of Examples 3–1 3 2 3–3 5–1 5 2 5–3 5–4 5–5 6–1 6 2 6–3 6–4 6–5 7–1 7 2 7–3 7–4 7–5 7–6 7–7 7–8 7–9 7–10 7–11 7– 12 7–13 7–14 7–15 7–16 7–17 7–18 7–19 7 20 7 21 7 22 7 23 xxviii Loading Data in Fixed Record Format ... Delimiter Marks in the Data Maximum Length of Delimited Data xvi 6-4 6-5 6-6 6-7 6-7 6-8 6-8 6-9 6-9 6-10 6-10 6-10 6-11 6- 12 6-13 6-14 6-14 6-14 6-15 6-16 6-18 6-19 6-19 6 -20 6 -20 6 -21 6 -21 6 -22 6 -22 6 -23 6 -24 6 -25 6 -25 6 -26 6 -27 Loading Trailing Blanks with Delimiters Conflicting Field Lengths for Character Datatypes Predetermined Size Fields Delimited... 11 Log File for Case Study 11 Loaded Tables for Case Study 11 10 -21 10 -23 10 -24 10 -25 10 -25 10 -26 10 -26 10 -28 10 -28 10 -29 10-31 10-31 10- 32 10-34 10-34 10-35 10-35 10-36 10-37 10-38 10-39 10-40 10-41 10- 42 10-43 10-43 10-45 10-45 10-47 10-48 10-49 10-49 10-50 10- 52 xxiii Part III 11 External Tables External Tables Concepts The Access Driver External... Using Oracle Version 5 Export Files Restrictions When Using Different Releases and Versions of Export and Import The CHARSET Parameter Part II 3 2- 70 2- 70 2- 70 2- 71 2- 71 2- 71 2- 71 2- 71 2- 72 2- 72 2-73 SQL*Loader SQL*Loader Concepts SQL*Loader Features SQL*Loader Control File Input Data and Datafiles Fixed Record Format ... Database Writes on SQL*Loader Direct Path and Conventional Path Using DBMS_METADATA.FETCH_XML() Using DBMS_METADATA.FETCH_DDL() 1 -2 1-51 2- 3 3-3 6-43 6-46 6-47 6-47 6-48 6-48 9-3 15-7 15-9 List of Tables 1–1 1 2 1–3 1–4 1–5 1–6 2 1 2 2 2–3 2 4 4–1 5–1 5 2 5–3 5–4 5–5 5–6 6–1 6 2 6–3 6–4 6–5 6–6 10–1 14–1 15–1 15 2 B–1 C–1 Objects Exported and Imported in Each Mode 1-9 Sequence... xxvi 13 -2 13 -2 13 -2 13-3 13-3 13-4 13-5 13-5 13-6 15 -2 15 -2 15 -2 15-3 15-3 15-4 DBMS_METADATA and Security DBMS_METADATA Programmatic Interface Using the DBMS_METADATA.FETCH_XML Procedure Using the DBMS_METADATA.FETCH_DDL Procedure Performance Tips for the Programmatic Interface of the Metadata API DBMS_METADATA Browsing Interface Example: Using the DBMS_METADATA . 2- 20 DESTROY 2- 20 FEEDBACK 2- 20 FILE 2- 21 FILESIZE 2- 21 viii FROMUSER 2- 22 FULL 2- 22 GRANTS 2- 22 HELP 2- 23 IGNORE 2- 23 INDEXES 2- 24 INDEXFILE 2- 24 LOG 2- 25 PARFILE 2- 25 RECORDLENGTH 2- 25 RESUMABLE 2- 26 RESUMABLE_NAME. 2- 26 RESUMABLE_NAME 2- 26 RESUMABLE_TIMEOUT 2- 26 ROWS 2- 27 SHOW 2- 27 SKIP_UNUSABLE_INDEXES 2- 27 STATISTICS 2- 27 STREAMS_CONFIGURATION 2- 28 STREAMS_INSTANTIATION 2- 28 TABLES 2- 29 Table Name Restrictions 2- 30 TABLESPACES. 1 -20 DIRECT 1 -20 FEEDBACK 1 -20 FILE 1 -20 FILESIZE 1 -21 FLASHBACK_SCN 1 -22 FLASHBACK_TIME 1 -22 FULL 1 -23 GRANTS 1 -23 HELP 1 -23 INDEXES 1 -23 LOG 1 -23 OBJECT_CONSISTENT 1 -24 OWNER 1 -24 PARFILE 1 -24 QUERY