Oracle7 Server Utilities

Contents Index Home Previous Next

Example Import Sessions

This section gives some examples of import sessions that show you how to use the command-line and interactive methods. The examples illustrate three scenarios:

Example Import of Selected Tables for a Specific User

In this example, using a full database export file, an administrator imports selected tables from a specific schema. With the command-line method, you specify FROMUSER=(schema) and TABLES=(tablename). If schema is not specified, it defaults to the schema from which the previous table was imported.

If there is not a previous table, it defaults to the importer's schema. In the following example, schema defaults to SCOTT for table DEPT.

Command Line Method

imp system/manager file=dba.dmp fromuser=scott tables="(emp,dept)"

Interactive Method

imp system/manager
...
Import file: expdat.dmp > 
Enter insert buffer size (minimum is 4096) 30720> 
Export file created by EXPORT:V07.01.03
List contents of import file only (yes/no): no > 
Ignore create error due to object existence (yes/no): yes > 
Import grants (yes/no): yes > 
Import table data (yes/no): yes > 
Import entire export file (yes/no): yes > no
Username: scott
Enter table names. Null list means all tables for user
Enter table name or . if done: dept
Enter table name or . if done: emp
Enter table name or . if done: .

Import Messages

Export file created by EXPORT:V07.01.03
Warning: the objects were exported by SCOTT, not by you
. importing SCOTT's objects into SYSTEM
. . importing table "DEPT"                         7 rows imported
. . importing table "EMP"                         22 rows imported
Import terminated successfully without warnings.

Example Import of Tables Exported by Another User

This example illustrates importing selected tables from a file exported by another Oracle user.

Command Line Method

imp adams/ez4me file=scott.dmp tables="(emp,dept)"

Interactive Method

imp adams/ez4me
...
Import file: expdat.dmp > scott.dmp
Enter insert buffer size (minimum is 4096) 30720> 
Export file created by EXPORT:V07.01.03
Warning: the objects were exported by SCOTT, not by you
List contents of import file only (yes/no): no > 
Ignore create error due to object existence (yes/no): yes > 
Import grants (yes/no): yes > n
Import table data (yes/no): yes > 
Import entire export file (yes/no): yes > n
Username: scott
Enter table names. Null list means all tables for user
Enter table name or . if done: emp
Enter table name or . if done: dept
Enter table name or . if done: .

Import Messages

Export file created by EXPORT:V07.01.03
Warning: the objects were exported by SCOTT, not by you
. importing SCOTT's objects into ADAMS
. . importing table "EMP"                         22 rows imported
. . importing table "DEPT"                         7 rows imported
Import terminated successfully without warnings.

Example Import of Tables from One User to Another

In this example, a DBA imports all tables belonging to one user into another user's account. The command-line interface is required for this case, because the TOUSER parameter cannot be specified interactively.

Command Line Method

imp system/manager file=scott.dmp fromuser=scott touser=rosemary
tables=(*)           [use an asterisk to specify all tables]

Import Messages

Export created by Oracle version EXPORT:V7.2
.. importing table "BONUS"			32 rows imported
.. importing table "SALGRADE"		10 rows imported


Contents Index Home Previous Next