18 Export and Import Utilities Copyright © Oracle Corporation, 2002 All rights reserved Objectives After completing this lesson, you should be able to the following: • Describe the uses of the Export and Import utilities • Describe Export and Import concepts and structures • Perform simple Export and Import operations • List guidelines for using Export and Import 18-2 Copyright © Oracle Corporation, 2002 All rights reserved Oracle Export and Import Utilities Oracle database Export Oracle database 18-3 Import Copyright © Oracle Corporation, 2002 All rights reserved Oracle Export and Import Utility Overview You can use these utilities to the following: • Archive historical data • Save table definitions to protect them from user error failure • Move data between machines and databases or between different versions of the Oracle server • Transport tablespaces between databases 18-4 Copyright © Oracle Corporation, 2002 All rights reserved Methods of Invoking the Export and Import Utilities • • • • 18-6 Command-line interface An interactive dialog Parameter files Oracle Enterprise Manager Copyright © Oracle Corporation, 2002 All rights reserved Export Modes Table Mode User Mode Tablespace Mode Table definitions Tables definitions Table definitions Table data (all or selected rows) Tables data Owner’s table grants Owner’s grants Owner’s table indexes Table constraints 18-7 Owner’s indexes Tables constraints Full Database Mode Tables definitions Tables data Grants Grants Indexes Indexes Table constraints Tables constraints Triggers Copyright © Oracle Corporation, 2002 All rights reserved Invoking Export • Syntax: exp keyword = value, value2, … ,valuen • Examples: exp hr/hr TABLES=employees,departments rows=y file=exp1.dmp exp system/manager OWNER=hr direct=y file=expdat.dmp exp \'username/password AS SYSDBA\' TRANSPORT_TABLESPACE=y TABLESPACES=ts_emp log=ts_emp.log 18-9 Copyright © Oracle Corporation, 2002 All rights reserved Using the Export Wizard 18-12 Copyright © Oracle Corporation, 2002 All rights reserved Direct-Path Export Concepts Oracle Server Export Generate SQL commands Two-Task SQL Buffer common command cache (TTC) processing manager Export TTC buffer Dump file Evaluating buffer Buffer cache Direct Path Direct Path Conventional Path 18-13 Copyright © Oracle Corporation, 2002 All rights reserved Write blocks Read blocks Direct-Path Export Features • • • 18-14 The type of Export is indicated on the screen output, export dump file, and the log file Data is already in the format that Export expects, avoiding unnecessary data conversion Uses an optimized SQL SELECT statement Copyright © Oracle Corporation, 2002 All rights reserved Direct-Path Export Restrictions • • • 18-15 The direct-path option cannot be invoked interactively Client-side and server-side character sets must be the same The BUFFER parameter has no affect Copyright © Oracle Corporation, 2002 All rights reserved Specifying Direct-Path Export • As command line argument to the Export command: exp userid=hr/hr full=y direct=y • As a keyword in a parameter file: exp parfile= Parameter file … (Other Parameters) DIRECT = Y … (Other Parameters) 18-16 Copyright © Oracle Corporation, 2002 All rights reserved Uses of the Import Utility for Recovery • • • • 18-17 Create table definitions Extract data from a valid Export file Import from a complete or cumulative Export file Recover from user-error failures Copyright © Oracle Corporation, 2002 All rights reserved Import Modes 18-18 Mode Description Table Import specified tables into a schema User Import all objects that belong to a schema Tablespace Import all definitions of the objects contained in the tablespace Full Database Import all objects from the export file Copyright © Oracle Corporation, 2002 All rights reserved Invoking Import • Syntax: imp keyword = value or keyword = value, value2, … value n • Examples: imp hr/hr TABLES=employees,departments rows=y file=exp1.dmp imp system/manager FROMUSER=hr file=exp2.dmp imp \'username/password AS SYSDBA\' TRANSPORT_TABLESPACE=y TABLESPACES=ts_employees 18-19 Copyright © Oracle Corporation, 2002 All rights reserved Using the Import Wizard 18-21 Copyright © Oracle Corporation, 2002 All rights reserved Invoking Import as SYSDBA • You need to invoke Import as SYSDBA under the following conditions: – At the request of Oracle technical support – When importing a transportable tablespace set • To invoke Import as SYSDBA: imp \'username/password AS SYSDBA\' 18-22 Copyright © Oracle Corporation, 2002 All rights reserved Import Process Sequence 18-23 New tables are created Data is imported Indexes are built Triggers are imported Integrity constraints are enabled on the new tables Any bitmap, functional, and/or domain indexes are built Copyright © Oracle Corporation, 2002 All rights reserved Globalization Support Considerations • • • 18-24 The Export file identifies the character encoding scheme that is used for the character data in the file The Import utility translates data to the character set of its host system A multibyte character set Export file must be imported into a system that has the same characteristics Copyright © Oracle Corporation, 2002 All rights reserved Summary In this lesson, you should have learned how to: • Describe the uses of Export and Import • Describe Export and Import concepts and structures • Perform simple Export and Import operations • List guidelines for using Export and Import 18-25 Copyright © Oracle Corporation, 2002 All rights reserved Practice 18 Overview This practice covers the following topics: • Using the Export utility • Using the Import utility 18-26 Copyright © Oracle Corporation, 2002 All rights reserved 18-28 Copyright © Oracle Corporation, 2002 All rights reserved [...]... multibyte character set Export file must be imported into a system that has the same characteristics Copyright © Oracle Corporation, 2002 All rights reserved Summary In this lesson, you should have learned how to: • Describe the uses of Export and Import • Describe Export and Import concepts and structures • Perform simple Export and Import operations • List guidelines for using Export and Import 18-25 Copyright... Uses of the Import Utility for Recovery • • • • 18-17 Create table definitions Extract data from a valid Export file Import from a complete or cumulative Export file Recover from user-error failures Copyright © Oracle Corporation, 2002 All rights reserved Import Modes 18-18 Mode Description Table Import specified tables into a schema User Import all objects that belong to a schema Tablespace Import all... the Import Wizard 18-21 Copyright © Oracle Corporation, 2002 All rights reserved Invoking Import as SYSDBA • You need to invoke Import as SYSDBA under the following conditions: – At the request of Oracle technical support – When importing a transportable tablespace set • To invoke Import as SYSDBA: imp \'username/password AS SYSDBA\' 18-22 Copyright © Oracle Corporation, 2002 All rights reserved Import. ..Direct-Path Export Restrictions • • • 18-15 The direct-path option cannot be invoked interactively Client-side and server-side character sets must be the same The BUFFER parameter has no affect Copyright © Oracle Corporation, 2002 All rights reserved Specifying Direct-Path Export • As command line argument to the Export command: exp userid=hr/hr full=y direct=y • As... created Data is imported Indexes are built Triggers are imported Integrity constraints are enabled on the new tables Any bitmap, functional, and/ or domain indexes are built Copyright © Oracle Corporation, 2002 All rights reserved Globalization Support Considerations • • • 18-24 The Export file identifies the character encoding scheme that is used for the character data in the file The Import utility... a schema User Import all objects that belong to a schema Tablespace Import all definitions of the objects contained in the tablespace Full Database Import all objects from the export file Copyright © Oracle Corporation, 2002 All rights reserved Invoking Import • Syntax: imp keyword = value or keyword = value, value2, … value n • Examples: imp hr/hr TABLES=employees,departments rows=y file=exp1.dmp... operations • List guidelines for using Export and Import 18-25 Copyright © Oracle Corporation, 2002 All rights reserved Practice 18 Overview This practice covers the following topics: • Using the Export utility • Using the Import utility 18-26 Copyright © Oracle Corporation, 2002 All rights reserved 18-28 Copyright © Oracle Corporation, 2002 All rights reserved ... uses of the Export and Import utilities • Describe Export and Import concepts and structures • Perform simple Export and Import operations • List guidelines for using Export and Import 18-2 Copyright... Describe the uses of Export and Import • Describe Export and Import concepts and structures • Perform simple Export and Import operations • List guidelines for using Export and Import 18-25 Copyright... rights reserved Oracle Export and Import Utilities Oracle database Export Oracle database 18-3 Import Copyright © Oracle Corporation, 2002 All rights reserved Oracle Export and Import Utility Overview